0

My end goal is to read any JSON schema and represent it in a tree(HTML).

For this I need a method to parse JSON schema (right?). I went through the implementations in this page and this editor which outputs an html form from JSON schema.

What I am asking is whether there is any optimum open source solution I can use or is my approach wrong?

Is there a way to get a list of properties along with their attributes?

4
  • 1
    Sounds like you are asking for an XML output. Check this link utilities-online.info/xmltojson/#.V9kZd5MrJTZ If this converts your json appropriately look at different JSON to XML functions in your preferred technology Commented Sep 14, 2016 at 9:36
  • Actually I'm looking for a way to read a JSON schema Commented Sep 14, 2016 at 9:38
  • mean Schema Generator? to json? solution exist xml2json Commented Sep 14, 2016 at 12:19
  • jsonviewer.stack.hu copy your json into there. that will help you read it. If you are trying to read it with your preferred programming language look at the decode functions. e.g. in php json_decode($your_json_var). hope that helps Commented Sep 15, 2016 at 2:52

1 Answer 1

1

You can use Ajv with custom keywords to create a JSON data processor/parser (JSON Schema will be used as data in your case).

You will need to define a schema with custom keywords that would be used to process your schema and generate/collect any side effects you need in the validation context (you'll need to pass this context to validation function with call/apply method and use passContext option so it is passed to subschemas and custom keywords).

This approach is used in JSONScript evaluation schema to evaluate script (but instead of script you would pass your schema as data).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.