mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-18 00:10:51 -07:00
recreate original documented issue
This commit is contained in:
parent
1f4e836863
commit
f69466f4c2
1 changed files with 43 additions and 1 deletions
44
XMLTest.java
44
XMLTest.java
|
@ -438,5 +438,47 @@ public class XMLTest {
|
||||||
assertTrue("7. inner array size 2", jsonArray.length() == 2);
|
assertTrue("7. inner array size 2", jsonArray.length() == 2);
|
||||||
assertTrue("7. inner array item 0", "val1".equals(jsonArray.get(0)));
|
assertTrue("7. inner array item 0", "val1".equals(jsonArray.get(0)));
|
||||||
assertTrue("7. inner array item 1", "".equals(jsonArray.get(1)));
|
assertTrue("7. inner array item 1", "".equals(jsonArray.get(1)));
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Confirm behavior of original issue
|
||||||
|
*/
|
||||||
|
String jsonStr =
|
||||||
|
"{"+
|
||||||
|
"\"Profile\": {"+
|
||||||
|
"\"list\": {"+
|
||||||
|
"\"history\": {"+
|
||||||
|
"\"entries\": ["+
|
||||||
|
"{"+
|
||||||
|
"\"deviceId\": \"id\","+
|
||||||
|
"\"content\": {"+
|
||||||
|
"\"material\": ["+
|
||||||
|
"{"+
|
||||||
|
"\"stuff\": false"+
|
||||||
|
"}"+
|
||||||
|
"]"+
|
||||||
|
"}"+
|
||||||
|
"}"+
|
||||||
|
"]"+
|
||||||
|
"}"+
|
||||||
|
"}"+
|
||||||
|
"}"+
|
||||||
|
"}";
|
||||||
|
jsonObject = new JSONObject(jsonStr);
|
||||||
|
xmlStr = XML.toString(jsonObject);
|
||||||
|
/**
|
||||||
|
* This is the created XML. Looks like content was mistaken for
|
||||||
|
* complex (child node + text) XML.
|
||||||
|
* <Profile>
|
||||||
|
* <list>
|
||||||
|
* <history>
|
||||||
|
* <entries>
|
||||||
|
* <deviceId>id</deviceId>
|
||||||
|
* {"material":[{"stuff":false}]}
|
||||||
|
* </entries>
|
||||||
|
* </history>
|
||||||
|
* </list>
|
||||||
|
* </Profile>
|
||||||
|
*/
|
||||||
|
assertTrue("nothing to test here, see comment on created XML, above", true);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue