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

Keep proper data type for JSON arrays between conversions. & Fixed conversions for nested JSON arrays and single element Array #33

Closed
wants to merge 4 commits into from

Conversation

kra3
Copy link

@kra3 kra3 commented Dec 16, 2015

If you convert a JSON array into XML and back to JSON, every data types in the array will be converted to string.

ie., {"k": [34, true, "val"]} -> xml -> json => {"k": ["34", "true", "val"]}

That's fixed in this commit as is done for JSONObjects.

Second commit does proper conversions for following cases (multi array nesting is now possible):

[['val', 32]] -> xml -> json => [['val', 32]]
[32] -> xml -> json => [32]

@kra3
Copy link
Author

kra3 commented Dec 17, 2015

Second commit fixes a lot of conversion issues where there are JSON arrays (even nested) as mentioned in my comment on #7

@kra3 kra3 changed the title Keep proper data type for JSON arrays between conversions. Keep proper data type for JSON arrays between conversions. & Fixed conversions for nested JSON arrays and single element Array Dec 17, 2015
@kra3
Copy link
Author

kra3 commented Dec 17, 2015

Do you have an example for such an problematic scenario?

@@ -974,6 +980,12 @@ private boolean isNullObject(Element element) {
&& (element.getAttribute(addJsonPrefix("class")) != null && element.getAttribute(addJsonPrefix("type")) != null)) {
return true;
}
// String clazz = getClass(element);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are new code, which is introduced as part of development, should be cleaned up from code base.

@aalmiray
Copy link
Collaborator

Transforming from XML (elements with class attribute) to JSON is enough. I think this PR only covers one specific use case (JSON -> XML -> JSON) but may hurt the other ones

@aalmiray aalmiray closed this Oct 14, 2019
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

Successfully merging this pull request may close these issues.

2 participants