Last active
September 21, 2018 07:39
-
-
Save allienna/4ee0cad8589e1d59986cf0839b9ea077 to your computer and use it in GitHub Desktop.
Jsonpath to json schema requirement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I would like to generate a json schema from a list of jsonpath. | |
Example: | |
For this kind of input, | |
``` | |
$.firstName | |
$.lastName | |
$.address.streetAddress | |
$.address.city | |
$.address.postalCode | |
$.phoneNumbers[0].type | |
$.phoneNumbers[0].number | |
``` | |
the result should be: | |
``` | |
{ | |
"firstName": "John", | |
"lastName" : "doe", | |
"address" : { | |
"streetAddress": "", | |
"city" : "", | |
"postalCode" : "" | |
}, | |
"phoneNumbers": [ | |
{ | |
"type" : "", | |
"number": "" | |
} | |
] | |
} | |
``` | |
From now, I don't know how can I do this... So, if someone have some kind of algorithm in mind, I'll take it :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment