how to convert YANG data model to JSON data?

强颜欢笑 提交于 2019-12-07 18:03:00

问题


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?


回答1:


  1. Convert yang to xml using pyang -f yin filename
  2. Convert xml file to json using any of the solutions below https://stackoverflow.com/a/10201397/3283069 https://stackoverflow.com/a/6465496/3283069



回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!