开发者

MFC :: Modify the values in a json file

开发者 https://www.devze.com 2022-12-15 14:52 出处:网络
I\'m able to parse json files in MFC but is having a hard time modifying the values. Is there an easier way writing new values, other than converting it to native file types, modifying the contents an

I'm able to parse json files in MFC but is having a hard time modifying the values. Is there an easier way writing new values, other than converting it to native file types, modifying the contents and converting it back to json again?

I thought it would be as easy as changing values in an XML file where you just look for the tag and change i开发者_Python百科t's value.

thanks...


You can use JSON Spirit library. The way it traverses through the json file is through it's key and value which is treated as a "pair". All you have to do is loop through the objects and search for the pair you want to replace. That's it...

The details aren't shown here, but pretty much gives you the basics -> http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx. It's got a bunch of methods you could use for whatever operation you want.

:)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号