帮助JSON文件 [英] Help with JSON files

查看:127
本文介绍了帮助JSON文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我想在C ++程序中编写和读取JSON文件中的数据。我已经处理过文本文件并知道如何实现文件I / O.But JSON就是我刚才听到的。这是一个简单的程序,涉及阅读,编写和修改记录。这些记录是从JSON文件中读取和写入的。



我通过互联网搜索并发现我需要一个解析器库。所以我下载了JSONcpp。但是没有关于如何使用它来编码和解码JSON文本的文档。最欢迎任何帮助或有用的链接!

Actually I want to write and read data from JSON files in a C++ program.I have worked on text files and know how to implement file I/O for the same.But JSON is what I have just heard of.This is a simple program that involves reading,writing and modifying records. The records are read from and write onto JSON files.

I searched over the internet and found I need a parser library for the same.So I downloaded JSONcpp. But there's no documentation regarding how to use it to encode and decode JSON text.Any help or helpful links are most welcomed!

推荐答案

项目页面包含如何例子。



http://jsoncpp.sourceforge.net/ [ ^ ]



The project page includes a "how to" example.

http://jsoncpp.sourceforge.net/[^]

Json::Value root;   // will contains the root value after parsing.
Json::Reader reader;
bool parsingSuccessful = reader.parse( config_doc, root );
if ( !parsingSuccessful )


这篇关于帮助JSON文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆