Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have the following json file (tfileinputRaw input file )
Input :
[{"_comp":"1","Name":"ABC"} ,
{"_comp":"1","Name":"ZYX"} ,
{"_comp":"1","Name":"MNO"},
{"_comp":"1","Name":"YZX"}]
Output : Expected
{"_comp":"1","Name":"ABC"}
{"_comp":"1","Name":"ZYX"}
{"_comp":"1","Name":"MNO"}
{"_comp":"1","Name":"YZX"}
My requirement is
1. To remove the square brackets [] at the start and end of the file. (There can be square brackets inside the file at other places, it has to be left untouched; only if there is any square brackets at start and end of the file it has to be removed if there is no square brackets it can be left as it is)
2. To remove comma (,) after each record is done.
New records can be identified whenever {"_comp": is encountered.
So I plan the job to be
tfileinputRaw ==> tjava ==>tfileoutputRaw
in tjava logic planned => if there is , (comma) or [ (open square brackets) before {"_comp": then it has to be replaced with space else do no changes. Also remove ] (close square brackets) at EOF if present, if not present nothing else to be done.
Please help me how to implement this logic in tjava.
{
"payload": "{
\"state\":{
\"desired\":{
\"uiud\":\"F0038C95FF5C91820\",
\"led\":1536768996,
}
}
}"
}