Comments (5)
@marcomorain Yes, a check like this seems very useful. One more reason to implement this.
from parson.
Yes, it would be. I could add json_value_get_parent
to get parent value in addition to json_object_get_enclosing_value
and json_array_get_enclosing_value
to get values that point to object/array. It would be a bit clunky, but then again: it's not something people use very often. Any thoughts on this?
from parson.
it's not something people use very often
indeed, for simple applications it is not needed.
and for complex applications that do recursive parsing it can be overcome by always passing the root to each call.
if you think an extra pointer is too expensive for most use cases, you can add it conditionally, and enable it with a preprocessor definition.
or you can postpone it, until more requests are recorded.
just for the record, except the need to reach the root node during some recursions (easily overcome), using your parser is quite straightforward and convenient. thank you!
from parson.
I might add this feature in future, because it seems pretty easy to implement and it only requires 3 functions added to the api. I'll leave this issue open to not forget about it and in case someone else has a similar idea.
Anyway, it's nice to hear that you find parson useful :)
from parson.
I have another use-case where parent pointers might be useful.
I recently started using parson and I incorrectly thought I could share a JSON array as a child of two seperate JSON objects. I ended up with a crash when freeing the second object (a double free of the array I think).
If objects have a parent pointer then parson could assert much earlier about my incorrect use of the API - when setting an item to be the child of another the item should have a null parent pointer.
from parson.
Related Issues (20)
- undeclared identifier 'SIZE_MAX' HOT 4
- CModule fails on my CentOS device with opennssl error HOT 2
- LLVM clang 4.0.3 compliation - "%g is unsupported" HOT 4
- Excess precision for small floating point numbers. HOT 16
- kgabis.github.com/parson returns 404 HOT 1
- Is it possible to add option to ignoring the last comma? HOT 3
- Build using meson HOT 13
- JSON Merge HOT 1
- Question on errors - Get information about what failed HOT 1
- why not check the "processed" in parson.c
- clublog-users.json.zip HOT 1
- scan-build bugs
- Accepting invalid array HOT 1
- EOF not enforced HOT 1
- Completion of error handling
- Improve exception handling
- Segmentation fault after invoking json_object_clear() and json_object_remove() back to back. HOT 1
- What if enclosingn [] is missing? HOT 3
- sprintf hard-deprecated on MacOS prevents compiling HOT 3
- Validate JSON inputs HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parson.