Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/sovereignty/campaigns/
{
"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
}
@aquarhead

This comment has been minimized.

Copy link

@aquarhead aquarhead commented Jul 6, 2015

Why do we give out id_str when we already have id? Maybe strip that to save some bandwidth?

@narthollis

This comment has been minimized.

Copy link

@narthollis narthollis commented Jul 7, 2015

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