Last active
August 29, 2015 14:23
-
-
Save regner/69190d239609fb8b016a to your computer and use it in GitHub Desktop.
/sovereignty/campaigns/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"totalCount_str": "2", | |
"items": [ | |
{ | |
"eventType_str": "3", | |
"campaignID": 2, | |
"eventType": 3, | |
"sourceSolarsystem": { | |
"id_str": "30004712", | |
"href": "http://publicCrest.regner.dev:8095/solarsystems/30004712/", | |
"id": 30004712, | |
"name": "NOL-M9" | |
}, | |
"attackers": { | |
"score": 0.5 | |
}, | |
"campaignID_str": "2", | |
"sourceItemID": 60014926, | |
"startTime": "2015-06-29T09:56:13", | |
"sourceItemID_str": "60014926", | |
"defender": { | |
"defender": { | |
"id_str": "99000002", | |
"href": "http://publicCrest.regner.dev:8095/alliances/99000002/", | |
"id": 99000002, | |
"name": "One One Corporation Alliance" | |
}, | |
"score": 0.5 | |
}, | |
"constellation": { | |
"id_str": "20000689", | |
"href": "http://publicCrest.regner.dev:8095/constellations/20000689/", | |
"id": 20000689, | |
"name": "B4H-9W" | |
} | |
}, | |
{ | |
"sourceItemID_str": "60014950", | |
"eventType_str": "4", | |
"campaignID": 3, | |
"eventType": 4, | |
"sourceSolarsystem": { | |
"id_str": "30004720", | |
"href": "http://publicCrest.regner.dev:8095/solarsystems/30004720/", | |
"id": 30004720, | |
"name": "0N-3RO" | |
}, | |
"campaignID_str": "3", | |
"sourceItemID": 60014950, | |
"startTime": "2015-06-29T15:09:59", | |
"scores": [ | |
{ | |
"score": 0.05, | |
"team": { | |
"id_str": "99000002", | |
"href": "http://publicCrest.regner.dev:8095/alliances/99000002/", | |
"id": 99000002, | |
"name": "One One Corporation Alliance" | |
} | |
} | |
], | |
"constellation": { | |
"id_str": "20000690", | |
"href": "http://publicCrest.regner.dev:8095/constellations/20000690/", | |
"id": 20000690, | |
"name": "6-UCYU" | |
} | |
} | |
], | |
"pageCount": 1, | |
"pageCount_str": "1", | |
"totalCount": 2 | |
} |
The string representations of the numeric fields exist because JavaScript does not have an Integer primitive, only float.
Example:
If the ID was 10000, after being parsed in JavaScript the numeric representation may not actual be 10000. It may instead be something like 9999.9999999999 or 10000.000000000001.
This shouldn't be a problem in languages that have a true Integer type, however some JSON libraries parse all numeric types as floats, and so also have this problem.
Because of this it is standard form to provide all numeric values where accuracy matters as both a numeric and a string representation of the numeric value.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why do we give out
id_str
when we already haveid
? Maybe strip that to save some bandwidth?