Skip to content

Enhancement: allow user to decide whether the output schema should list the key in original order #19

@khoadaniel

Description

@khoadaniel

Hi jsontypedef team,

First of all, thank you for building this tool.

In my use case I have a really long schema to be inferred, and verifying the inferred schema with the original json input takes some time because their key orders are not the same. I can sort the input's keys with some workaround python scripts but it would be awesome if you can integrate the following:

Current behavior:

  • All the keys in the output are sorted in alphabet order.
  • If users want to verify the schema output and the original input json, it would take longer time to navigate between the two because their key order has changed.

Example: "name" has been pushed to second place.

echo '{ "name": "Joe", "age": 42 }' | jtd-infer | jq

{
  "properties": {
    "age": {
      "type": "uint8"
    },
    "name": {
      "type": "string"
    }
  }
}

Expected behavior:

  • Allow users to decide whether the output keys are sorted or not with a command line parameter.

Thank you.

P/S: Great tool! It saves lots of time for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions