返回首页

JSON序列化(编组和解组):我需要一些如何序列化/ deserilize JSON格式的对象和从对象到JSON的例子。我用这个的的例子http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/index.html,但它只有一个简单的文本序列。在我的项目,其他requirenments,我成功使用boost库。我几乎可以肯定,我需要其他一些特定的库,如JSON的精神或标准的Qt库(QScriptEngine)。任何简单的例子,将是非常赞赏。

这是一个JSON文件的例子,我要序列化的类。

[{"DscTipoEstrutura":"Unidade de Neg\u00f3cio","FlgAtivo":true,"IdDominio":1,"IdTipoEstrutura":1,"NroOrdem":0},{"DscTipoEstrutura":"Regi\u00e3o","FlgAtivo":true,"IdDominio":1,"IdTipoEstrutura":2,"NroOrdem":1},{"DscTipoEstrutura":"Distrito","FlgAtivo":true,"IdDominio":1,"IdTipoEstrutura":3,"NroOrdem":2}]

PS:我发现同级http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx和http://boost-spirit.com/repository/applications/show_contents.php我需要,但因为我ç begnnier,我无法理解他们既不运行几个小时后一些的例子。我需要一些简单的例子。:8202575 |会员

回答