Skip to content

Standardize JSON response on arrays or objects #430

Open

Description

@waldoj

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions