I am facing a problem regarding JSON handling in Ruby. I have one string str1
and after a few minutes it's change to str2
:
str1 =
'{ "Person1": { "state": [ {"salery": "100", "time": "100"} ],
"temp": [{"age": "12","time": "200" }] },
"person2": { "state": [ {"salery": "12","time": "120"}],
"temp": [ {"age": "12","time": "220"}]}
}'
After it's changed to:
str1 =
'{
"Person1": { "state": [ {"salery": "changed", "time": "100"} ],
"temp": [{"age": "12","time": "200" }] },
"person2": { "state": [ {"salery": "12","time": "120"}],
"temp": [ {"age": "12","time": "220"}]}
}'
Depending on this change I need output only for changing the row, because here only row with str1 -> str2 is changed ({"salery": "100" -> "salery": "changed")
.
output:
{
"Person1": { "state": [ { "salery": "changed","time": "100"} ] }
}