Json object arrays

(4 posts) (2 voices)

Tags:

No tags yet.

  1. maron, Member

    Following up on this one, many tools expect json to be formatted as an array of objects as follows


    [{
    "firstname": "Jimmie",
    "lastname": "Barninger",
    "zip_code": 12345
    },
    {
    "firstname": "John",
    "lastname": "Doe",
    "zip_code": null
    }
    ]

    mydbr - using export=json&json_force_object=1 returns this instead


    {
    "0": {
    "firstname": "Jimmie",
    "lastname": "Barninger",
    "zip_code": 12345
    },
    "1": {
    "firstname": "John",
    "lastname": "Doe",
    "zip_code": null
    }
    }

    Any chance to introduce an force_json_object_array parameter

  2. myDBR Team, Key Master

    Sure, we can add it.

    --
    myDBR Team

  3. myDBR Team, Key Master

    Maron,
    there is now an additional URL parameter json_object_array which you can set to "1" to get an JSON object array as response (export=json&json_object_array=1).

    --
    myDBR Team

  4. maron, Member

    Thanks - tested and works perfectly.


Reply

You must log in to post.