-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement JSON encoding #2
Comments
I don't think it's possible to make a JSON generator in this library. If you look at the declarations of However, I think it’s possible to write another library that would have the same spirit as this one: constant memory allocation and minimal footprint. I gave a lot of thoughts to this idea, and I came with the following API:
As you see, you'd need to specify the maximum size of In my projects, I've always use What do you think? Do you think you’d use such a library in you project? |
That sounds great! Yes we would definitely use it in our project. All we are after is simplicity in terms of the API. Yours was by far one of the easiest to use when we were evaluating all our JSON library options. Would it be hard to implement? |
It doesn't seem too hard. You can see the progress in the "add-generator" branch: |
Great, I'll keep an eye on it. One other thing that would be nice to implement is some sort of iterator-like interface on the JsonHashTable class. At the moment, you have to manually go over each key, which is a bit painful. So we could do something like the std::map class of C++. for ( auto i = jsonHashTable.begin(), i != jsonHashTable.end(); i++ ) { |
Sure, that sounds great. |
The work on the JSON encoding is almost completed.
Can you please try it and give me your comments? |
Perfect timing! I should be able to give this a try early next week or maybe even today! Thanks for your work. I'll let you know how it goes. |
I have raised another ticket for implementing the iterator, that would be icing on the cake for this library. At the moment you have to know the names of the keys inside a hashtable, but with the iterator you don't have to care. |
I managed to reduce the size of the code and the memory usage on this branch: BTW, do you have any feedback right now? |
Hi again, sorry about the late reply! Been a tad busy at work, so haven't had a chance to test it out yet. I plan to early next week, I'll post my feedback then. |
I have just started using your library (great, easy-to-use library by the way!) and I was wondering if it would be possible to implement JSON encoding as well.
At the moment, we have to hand-code outbound JSON (which is slightly painful and error-prone).
The text was updated successfully, but these errors were encountered: