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?
user3283069
- 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
Yang is a modeling language, not a data generation language.
What you are asking for is a simulator that will contain the same or pseudo logic as your application to generate data.
来源:https://stackoverflow.com/questions/30503356/how-to-convert-yang-data-model-to-json-data