Bwar / CJsonObject

Ultralightweight JSON parser in C++ based on cJSON
MIT License
648 stars 239 forks source link

昨天遇到一个负整数,double float 不兼容的 #4

Closed kematy closed 5 years ago

kematy commented 5 years ago

昨天遇到一个负整数,double float 不兼容的,比如-3 识别出来是个恨大的数值,希望能兼容一下。

Bwar commented 5 years ago

OK,这个周末修改兼容一下

Bwar commented 5 years ago

已兼容

kematy commented 5 years ago

谢谢

151711064@qq.com

发件人: Bwar 发送时间: 2019-07-27 16:29 收件人: Bwar/CJsonObject 抄送: kematy; Author 主题: Re: [Bwar/CJsonObject] 昨天遇到一个负整数,double float 不兼容的 (#4) 已兼容 ― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

kematy commented 5 years ago

你好,你是否上传了最新的版本,我这边试了一下,负整数还是不行

151711064@qq.com

发件人: Bwar 发送时间: 2019-07-27 16:29 收件人: Bwar/CJsonObject 抄送: kematy; Author 主题: Re: [Bwar/CJsonObject] 昨天遇到一个负整数,double float 不兼容的 (#4) 已兼容 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Bwar commented 5 years ago

有一个文件忘了提交,现在OK了

kematy commented 5 years ago

现在测试OK了。谢谢

Mrsandman327 commented 5 years ago

很棒, 我想请问一下在使用这个开源库的时候如何创建如下形式的数组 "employees": [ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName":"Jones" } ] 目前我知道能创建的仅限于如下这种 "employees": ["John Doe","Anna Smith","Peter Jones" ]

Bwar commented 5 years ago
neb::CJsonObject oJson;
oJson.AddEmptySubArray("employees");
oJson["employees"].Add(neb::CJsonObject("{}"));
oJson["employees"][0].Add("firstName", "John");
oJson["employees"][0].Add("lastName", "Doe");
oJson["employees"].Add(neb::CJsonObject("{}"));
oJson["employees"][1].Add("firstName", "Anna");
oJson["employees"][1].Add("lastName", "Smith");
oJson["employees"].Add(neb::CJsonObject("{}"));
oJson["employees"][2].Add("firstName", "Peter");
oJson["employees"][2].Add("lastName", "Jones");

neb::CJsonObject oJson;
oJson.AddEmptySubArray("employees");
oJson["employees"].Add(neb::CJsonObject("{\"firstName\":\"John\" , \"lastName\":\"Doe\"}"));
oJson["employees"].Add(neb::CJsonObject("{\"firstName\":\"Anna\" , \"lastName\":\"Smith\"}"));
oJson["employees"].Add(neb::CJsonObject("{\"firstName\":\"Peter\" , \"lastName\":\"Jones\"}"));

又或

neb::CJsonObject oJson;
neb::CJsonObject oJohn;
neb::CJsonObject oAnna;
neb::CJsonObject oPeter;
oJohn.Add("firstName", "John");
oJohn.Add("lastName", "Doe");
oAnna.Add("firstName", "Anna");
oAnna.Add("lastName", "Smith");
oPeter.Add("firstName", "Peter");
oPeter.Add("lastName", "Jones");
oJson.AddEmptySubArray("employees");
oJson["employees"].Add(oJohn);
oJson["employees"].Add(oAnna);
oJson["employees"].Add(oPeter);
Mrsandman327 commented 5 years ago

非常感谢

Mrsandman327 commented 5 years ago

请问GetKey()这个函数为什么只能用一次 就是比如有10个key,GetKey获取过一次之后,第二次就获取不到了 或者是第一次获取5个,第二次想全部获取,但只能获取到后5个,前五个是空的

Bwar commented 5 years ago

请问GetKey()这个函数为什么只能用一次 就是比如有10个key,GetKey获取过一次之后,第二次就获取不到了 或者是第一次获取5个,第二次想全部获取,但只能获取到后5个,前五个是空的

FAQ#1