项目作者: mircodezorzi

项目描述 :
header only library to convert yaml and xml files to nlohmann::json
高级语言: C++
项目地址: git://github.com/mircodezorzi/tojson.git
创建时间: 2019-08-20T20:01:05Z
项目社区:https://github.com/mircodezorzi/tojson

开源协议:

下载


tojson is a tiny (127 sloc), header only library to convert xml and yaml documents into nlohmann::json objects.

minimal functioning example

  1. #include <iostream>
  2. #include "tojson.hpp"
  3. int main() {
  4. using namespace tojson;
  5. using namespace tojson::emitters;
  6. nlohmann::json a = loadxml("./example.xml");
  7. nlohmann::json b = loadyaml("./example.yml");
  8. std::cout << a.dump() << std::endl;
  9. std::cout << b.dump() << std::endl;
  10. std::cout << toyaml(a) << std::endl;
  11. std::cout << toxml(b) << std::endl;
  12. }

dependencies

  • rapidxml
  • yaml-cpp
  • nlohmann::json