how to convert YANG data model to JSON data?
13,261
- Convert yang to xml using pyang -f yin filename
- Convert xml file to json using any of the solutions below https://stackoverflow.com/a/10201397/3283069 https://stackoverflow.com/a/6465496/3283069
Author by
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
How do I convert "YANG" data model to "JSON"? As there is many many docs available in web, in that they changed in YANG synatx to JSON but how the value for the leaf or leaf list they are getting? from where and how it will get actual data in JSON from YANG?
-
Alexander Bird over 6 yearsyang is a modeling language. json is a modeling language. It is very rational to convert data into a different format for different tools
-
kikas over 4 yearsYang is equivalent to JSON-schema. You can generate JSON objects from Yang models but not convert Yang to JSON unless I am not understanding this right.
-
Dave over 2 yearsThis does not work, also its messy. The yang structure is a structure language. Converting to "JSON" or "XML" is based on the structure of the system using it, so this process is not as easy as "feed the yang into a converter". You need to read documentation, and understand the structure of the system trying to process yang models.