Giter Site home page Giter Site logo

Comments (5)

woodruffw avatar woodruffw commented on August 21, 2024 1

As a consumer of this library, some kind of index-independent syntax would also be nice:

json_object_dotset_string(obj, "array[]", "itemN");

Where "array[]" indicates that the value should be appended to the array.

from parson.

Ethan-J-Liang avatar Ethan-J-Liang commented on August 21, 2024 1

Array notation is also something I was looking for. Like moe123's comment, some straightforward addressing scheme such as an_array.[1].an_object.key to access a certain element in an array will be very good.

from parson.

mu578 avatar mu578 commented on August 21, 2024

something like an_array.[1].an_object.key would be easier.

is_key_index(const char * path_elem) { ... }

from parson.

lidiahhh avatar lidiahhh commented on August 21, 2024

Hi,
I tried your code:

JSON_Value *cloud_pkt_value = json_value_init_object();
JSON_Object *cloud_pkt_object = json_object(cloud_pkt_value);

json_object_dotset_string(cloud_pkt_object, "array[0]", "item0");
json_object_dotset_string(cloud_pkt_object, "array[1]", "item1");

and then added
char * serialized_string = json_serialize_to_string(cloud_pkt_value );

but when i print serialized_string, i get:
{"array[0]":"item0","array[1]":"item1"}
instead of { "array": ["item0", "item1"]}.

Can you explain better how to create arrays?
thanks

from parson.

kgabis avatar kgabis commented on August 21, 2024

@lidiahhh it's not implemented, it's only a suggestion.

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.