Skip to content
TORNLIFE More

Bug in Get faction Basic

Started by Prokrist [585251] on in Bugs & Issues.

14 replies · 118 views · thread synced · 6 days ago · View on torn.com
About this thread

Posts archived: 15 / 15 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
15
Discussion span
→
People posting
5
Likes on archived posts
0
Posts by staff, officers and moderators
6
Authority score
59 / 100
Historical score
39 / 100
Story score
36 / 100
Engagement score
49 / 100
Prokrist [585251]

A faction has peace treaties :

"peace": {
"13129": 1495531145,
"24884": 1475144866
}

A faction does not have peace treaties:

"peace": [ ]

The first is an object (dictionary in this case), the second is an array.

http://www.json.org/

This kinda screws with my json to object mapping ... I can do a work around, but this looks like a bug to me.
Marc [24377]

I believe a similar issue was reported before and deemed not to be a bug, but let me pass this to Chedburn to see if it can be fixed (easily)
Prokrist [585251]

Hi Ched,

{ "ID": 36677, "name": "JRT", "leader": 1621492, "co-leader": 0, "best_chain": 29, "respect": 990, "rank": 1820, "peace": null, "members": { "660043": { "name": "Sinja", "days_in_faction": 2 }, "1621492": { "name": "StonedAndy75", "days_in_faction": 31 } }, "specials": { "chaining": 0, "vigor": 0, "enormity": 0, "steadfast": 0, "gallant": 0, "cumber": 0, "salutary": 0, "pertinent": 0, "adept": 0, "hermetic": 1 }, "wars": [ ], "naps": { "22492": 1470900097, "30820": 1470381237, "7049": 1470724141, "8397": 1471588142, "10614": 1472106542, "13665": 1471138380, "16296": 1470464941, "20567": 1472106542, "36661": 1469860142, "36662": 1470378542, "36667": 1470205742, "36675": 1470378542, "36678": 1470637741 } }



As you can see for this call the wars field = []. I think the problem is the serialization process where an object (Dictionary in this case) becomes a list.



I have been able to make a work around for this problem, and its more an annoyance than something else. (plzz do not delete the Wars field, I actually use that one)
Prokrist [585251]

{ "ID": 36677, "name": "JRT", "leader": 1621492, "co-leader": 660043, "best_chain": 29, "respect": 1005, "rank": 1816, "wars": [ ], "peace": [ ], "members": { "660043": { "name": "Sinja", "days_in_faction": 4 }, "1621492": { "name": "StonedAndy75", "days_in_faction": 32 } }, "specials": { "chaining": 0, "vigor": 0, "enormity": 0, "steadfast": 0, "gallant": 0, "cumber": 0, "salutary": 0, "pertinent": 0, "adept": 0, "hermetic": 1 }, "naps": { "22492": 1470900097, "30820": 1470381237, "7049": 1470724141, "8397": 1471588142, "10614": 1472106542, "13665": 1471138380, "16296": 1470464941, "20567": 1472106542, "36661": 1469860142, "36662": 1470378542, "36667": 1470205742, "36675": 1470378542, "36678": 1470637741 } }



Looks the same as before....
Marc [24377]

Can you please provide the URL, without your API key, of the request you're making that gets you this issue?
aurel1 [1046304] Admin Staff

I need a feedback from thread starter - I don't see any problems in that request atm, empty arrays are objects now?
Marc [24377]

I'm going to close this for now, but please post back when you have the url for aurel1 and I'll reconfirm the report.