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

Multi Array and Struct of Struct of ... Issue #1

Open
mehmetbezenk opened this issue Nov 1, 2022 · 12 comments
Open

Multi Array and Struct of Struct of ... Issue #1

mehmetbezenk opened this issue Nov 1, 2022 · 12 comments

Comments

@mehmetbezenk
Copy link

mehmetbezenk commented Nov 1, 2022

I encountered 2 problems while generating json. I want to create multiple array in a struct and struct of struct of ... .While debugging, I realized that it was caused by JSONVAR (FB) and made changes.

issue

  1. Change: I added at this statement for struct of struct of .. issue . You can look at added attached image.

  2. Change: I changed this statement for multiple array issue. You can see it at image.

Example of created json (struct of struct of.. ):
'{"header":{"stamp":{"sec":1666700230,"nanosec":666597925},"frame_id":"asad"},"goal_pose":{"position":{"x1":3.212,"y1":1.656,"z1":2.977},"orientation":{"x2":3.212,"y2":1.656,"z2":2.977}},"velocity":0.123,"acceleration":5.986}'

Thanks for the library.

@stefandreyer
Copy link
Owner

Hi Mehment,

thanks for your work.

Tim(who made this lib) already did some changes which may solve your problems to.

please try his lib and and give me a info.

lib

thanks!

BR Stefan

@mehmetbezenk
Copy link
Author

mehmetbezenk commented Nov 2, 2022

Hi Stefan,

I tried 1.0.0.14 version of library but i encountered an exception from pro_json.jsonvalue_to_string (fun).

Also you can try my work at library. These changes solved my problems.

This image library 1.0.0.14:

issue2

@stefandreyer
Copy link
Owner

stefandreyer commented Nov 10, 2022

Hi Memeht,

I teste your case, it still doesen't work with the lib of Tim.

I'm implementing your changes and will suggest Tim an new version.

With your changes I get:

{"test3":{"header":{"stamp":{"sec":1666700230,"nanosec":666597925},"frame_id":"asad"},"goal_pose":{"position":{"x1":3.212,"y1":1.656,"z1":2.977},"orientation":{"x2":3.212,"y2":1.656,"z2":2.977}},"velocity":0.123,"acceleration":5.986}}

Bevor:
{"test3":{"header":{"stamp":{"sec":1666700230,"nanosec":666597925},"frame_id":"asad"},"goal_pose":{"position":{"x1":3.212,"y1":1.656,"z1":2.977},"orientation":{"x2":3.212,"y2":1.656,"z2":2.977},"velocity":0.123,"acceleration":5.986}}

BR Stefan

@mehmetbezenk
Copy link
Author

Hi Mr. Stefan,

I have new problems.

  1. I am writing variable at number of the json_var. I do not set value type. I want to set variable as real and I'm writing the counter increment at number of json_var. The changes are in the integer json_var. In the integer of json_var, it also writes the multiples of 10 to the number of json_var. So, I don't see the changes in between ( ie. xx10-xx20 ) numbers.

*******IO_Value : ARRAY [1..255] OF JSONVAR;

3

  1. Sometimes It fills the json object incompletely or incorrectly.

1

2

Thanks,

Mehmet

@mehmetbezenk mehmetbezenk closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2022
@mehmetbezenk mehmetbezenk reopened this Nov 22, 2022
@stefandreyer
Copy link
Owner

Hi Mehment,

please try this version, Tim already solved some array problems, else, please show me the call of the FB.

PRO_JSON 1.0.0.15.zip

here I implementet your soulution too, and althoug the problem wirth the application name.

BR Stefan

@mehmetbezenk
Copy link
Author

mehmetbezenk commented Nov 23, 2022

Hi Stefan,

I am trying this new version but I have new problem with this.

new_problem

Also I think we should add the one in bottom picture.

new_problem2

Also Old problem is continuing...

new_problem3

@mehmetbezenk mehmetbezenk closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2022
@mehmetbezenk mehmetbezenk reopened this Nov 23, 2022
@stefandreyer
Copy link
Owner

Hi Mehment,

can you provide a simple program wich raises the problem?

Further more, Tim implementet a function which cuts of the trailing zero:
image

do you need it?

maybe a parameter will be usefull for that.

BR Stefan

@mehmetbezenk
Copy link
Author

Hi Stefan,

I'm sorry for the late reply.

I converted my project using network variable. But I prepared a simple program for you. You can download from the link below.

https://sendgb.com/NhA0RYfsDvw

Thanks to the Library
Best Regards
Mehmet Bezenk

@meijer3
Copy link

meijer3 commented Jan 10, 2023

I think I encouter this problem as well.
Where I wanted to get cns: [["ip", "10.1.1.5"],["mac", "00-30-AA-AA-AA-AA"]].
That would give me "cu":"http://wago.ii""cns[1]":["cns[2]":[]], and is an non-valid json aswell
MichielVanwelsenaere/HomeAutomation.CoDeSys3#77

@stefandreyer
Copy link
Owner

Hi Mehmet,

MAX_NAME_SIZE solves your Problem, your array name is too long:
image

What ist the "old Problem" missing ".0"?

BR Stefan

@stefandreyer
Copy link
Owner

@meijer3,

this is a different Problem, you want a anonymous array in a array. A named array would work.

BR Stefan

@mehmetbezenk
Copy link
Author

Hi Stefan,

I'm sorry for the late reply. I am busy at these days.

I do not any problem because of too long array name.

What ist the "old Problem" missing ".0"? ==> It's not a problem with the library. I work with large and floating numbers. You can understand what the problem is from the images in the attached document.

https://sendgb.com/SfdlIiYFbQk

Note : When I had a problem with the library, I used network variables. I plan to use it in next projects.

Thanks to the Library
Best Regards
Mehmet Bezenk

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

No branches or pull requests

3 participants