Question

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.

Was it helpful?

Solution

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 ],

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top