statedecoded
statedecoded copied to clipboard
Standardize JSON response on arrays or objects
The API is inconsistent in its use of arrays and objects. For example, from the law method:
"references": [
{
"id": "12528",
"section_number": "22.1-29.1",
"catch_line": "Public hearing before appointment of school board members.",
"url": "http://vacode.org/22.1-29.1/"
},
{
"id": "12533",
"section_number": "22.1-34",
"catch_line": "Application of article.",
"url": "http://vacode.org/22.1-34/"
}
],
"related": {
"0": {
"id": "7469",
"catch_line": "Department of education.",
"section_number": "15.2-531",
"url": "/15.2-531/"
},
"1": {
"id": "7618",
"catch_line": "Department of education.",
"section_number": "15.2-837",
"url": "/15.2-837/"
},
}
references is an array, while related is an object, with the former unenumerated, the latter enumerated. This is confusing, and makes the data difficult to parse. Fix this in a v1.1 of the API.