Giter VIP home page Giter VIP logo

Comments (5)

kgabis avatar kgabis commented on June 3, 2024 1

@marcomorain Yes, a check like this seems very useful. One more reason to implement this.

from parson.

kgabis avatar kgabis commented on June 3, 2024

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.

ilg-ul avatar ilg-ul commented on June 3, 2024

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.

kgabis avatar kgabis commented on June 3, 2024

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.

marcomorain avatar marcomorain commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.