159
rated 0 times
[
166]
[
7]
/ answers: 1 / hits: 18363
/ 11 Years ago, wed, may 15, 2013, 12:00:00
I am storing a json string into a text field in mysql.
After the insertion, i want to update my json string and add the mysql line id into it with jackson json.
I have a java String which is in Json format
{
thing:val
}
I'm looking to add another K/V without writing lines of codes.
to finally have this :
{
thing:val
mysqlId:10
}
I can convert my String to a JsonNode :
ObjectMapper mapper = new ObjectMapper();
JsonNode json = mapper.readTree( jsonStr);
Looking to do something like this
json.put(mysqlId,10);
json.toString();
then update in my text field with new json string in mysql
I can't make it.
I don't want use many class is there a simple way to do so with jackson?
More From » java