Skip to content

Fix JSON Preview response order #102

Description

@JoryHogeveen

Edge case with the order of results.
When the result keys are numeric (eg, ID's or just reordered list) when the JSON parser will reorder the list ASC.
This creates the impression in the Previewer that the order is incorrect while in fact it's fine in PHP and the raw response.

Few ideas:

  • Custom JSON parser, or a custom JSON reviver (second param for JSON.parse() )
  • Look into a React component to improve the JSON view and just send it encoded as a JSON string instead of a JSON response.
  • Don't use JSON?? No idea what would be better...

Examples

<?php
[
    "1" => 'one',
    "3" => 'three',
    "2" => 'two',
]

Becomes:

# JSON
{
    "1": "one",
    "2": "two",
    "3": "three"
}

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcomponent: Corepriority: PuntableThis issue is not blocking and can be punted to a later release

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions