Faster Json parser



  • Is the builtin Json parser faster than a 3th party library? Is it possible to parse a JSON string into a class like you can do, for example, with GSON Java? (gson.fromJson(json, Foo.class);

    Or manually navigate through JSON is the fastest way to parse it into a class?


  • Lifetime Qt Champion

    Hi
    That depends on what library you compare it against.
    It wont likely win over say
    https://github.com/Tencent/rapidjson
    However, if you end up converting to /from QString to use it in the app, it might be costly.
    There is no support for automatic (de)serialization. You have to write that manually.



  • @mrjj said in Faster Json parser:

    Hi
    That depends on what library you compare it against.
    It wont likely win over say
    https://github.com/Tencent/rapidjson
    However, if you end up converting to /from QString to use it in the app, it might be costly.
    There is no support for automatic (de)serialization. You have to write that manually.

    Well I get a JSON string from a file or from network so yes I think that manually parsing is better!



  • @TheEnigmist
    Do you only ever parse a given piece of JSON once, or do you repeatedly re-parse the same JSON? This may be blindingly obvious depending on your competence, but if you do re-parse then caching the result for re-use will be a big saving....



  • @JonB said in Faster Json parser:

    @TheEnigmist
    Do you only ever parse a given piece of JSON once, or do you repeatedly re-parse the same JSON? This may be blindingly obvious depending on your competence, but if you do re-parse then caching the result for re-use will be a big saving....

    I parse it totally and it changes over time so when I receive it again it has new values.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.