Skip to content
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

How to get value in array of structures in json? #49

Open
Alex-Thunder-315 opened this issue Apr 3, 2024 · 2 comments
Open

How to get value in array of structures in json? #49

Alex-Thunder-315 opened this issue Apr 3, 2024 · 2 comments

Comments

@Alex-Thunder-315
Copy link

Alex-Thunder-315 commented Apr 3, 2024

If we have the next json:
{ "a" : 1.0, "b" : 2.0 }
then we can get the value "a" using getReal("a").

How to get the value "a" for example of the first element "list" for the following example:
{ "list" : [ { "a" : 1, "b" : 2 }, { "a" : 2, "b" : 1 } ] }
In the examples there is a case when an array of values is considered, but such a case is not considered, thanks.

@beutlich
Copy link
Contributor

beutlich commented Apr 3, 2024

Obtaining individual data out of array is not yet supported by the library.

This sounds like a useful idea to add. "list[1].a" (with Modelica-like one-based indexing) might be some proper identifier for your task. (Note that there is no array-syntax support in the underlying parson lib itself).

@Alex-Thunder-315
Copy link
Author

Thanks for the answer. Yes, it would be great if processing of such json files was added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants