-
Notifications
You must be signed in to change notification settings - Fork 511
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
two-dimensional string array to JSON #54
Comments
can you give a sample code, with expected result? |
Hey @taowen! I want this JSON string to be crafted/produced by your JSON library without putting JSON formatting around the values and key names myself: "{\"type\": \"ANT_ACTION_GOLEFT\", \"color\": \"ANT_COLOR_BLUE\"}" So I want a normal String object to represent my key |
this is the input or output? If this is the output, what is the java code to define to object or map in the first place? Do you have a working piece of code? |
The quoted string is how it should look like (without the escape symbols of course). I want this output: {
"type": "ANT_ACTION_GOLEFT",
"color": "ANT_COLOR_BLUE"
} but I don't know what kind of string or array object I should pass to serializer so I get this output. I would expect a 2D String array to work but not sure. |
|
This works @taowen! Although it feels like it is a bit too complex for just two two keys with simple String values. Is there something where I can read up on which types are supported and how to put them into serializer, like to see if there are alternatives to HashMap for my case? |
this is the simplest way... |
Okay, fair enough. Thank you :)! The docs were a bit hard to understand for me as a newbie to this lib. |
I tried to convert a two-dimensional string array to a JSON string. How can I do this? I tried to use JsonStream.serialize() with my string:
I want a JSON with both keys on same level - not as a JSON array. Jsoniter is just parsing the String and gives back an object with same structure as input - not JSON format. Please point me to the right direction or where I should look at the docs. I tried it for one hour and got no real use results.
The text was updated successfully, but these errors were encountered: