문제

The problem is that JSONCPP has a bug. It does not read JSON file properly. We store 3D models in JSON and today we got a model that crash our app.

In short if we load that JSON (120KB) and save it new file we get 80KB. All vertexes are missing but normals, tangents, etc is still in file.

Please, recommend C++ JSON parser that is similar to JSONCPP as much as possible.

Upgrading JSONCPP does not help.

도움이 되었습니까?

해결책

The JSON you are using is invalid. Look at lines 1389 to 1392.

                 [ -0.5321721434593201, 0.0, 0.8466361761093140 ],
                 [ -0.5321721434593201, 0.0, 0.8466361761093140 ],
                 [ -0.5321721434593201, 0.0, 0.8466361761093140 ],
                 [ -0.5321721434593201, 0.0, 0.8466361761093140 ],
                 [ -1.#IND00000000000, -1.#IND00000000000, -1.#IND00000000000 ],
                 [ -1.#IND00000000000, -1.#IND00000000000, -1.#IND00000000000 ],
                 [ -1.#IND00000000000, -1.#IND00000000000, -1.#IND00000000000 ],
                 [ -1.#IND00000000000, -1.#IND00000000000, -1.#IND00000000000 ],
                 [ -0.5321709513664246, 0.0, -0.8466369509696960 ],
                 [ -0.5321709513664246, 0.0, -0.8466369509696960 ],
                 [ -0.5321710109710693, 0.0, -0.8466369509696960 ],
                 [ -0.5321710109710693, 0.0, -0.8466369509696960 ],

다른 팁

Try cJSON, which is a good ultralight weight JSON parser in ANSI C . We use them in commercial deployments for complex data transactions. I guess 3D models would come down to complex data, you can give a try.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top