I have a JSON file with the below details.
{
"item":[
{
"id":"MPS1",
"shortname":"fres",
"field1":"76,728.76",
"field2":"370.50",
"field3":"-1.40",
"field4":"-0.38",
"field5":"-1",
"details":null,
"test1":"589.73l",
"url":"http://www.google.com"
},
{
"id":"MPS2",
"shortname":"fres1",
"field1":"76,7281.761",
"field2":"3701.50",
"field3":"-1.140",
"field4":"-10.38",
"field5":"-11",
"details":1,
"test1":"589.73l",
"url":"http://www.google.com"
},
Like this I have 50 structures in a single file and I need to validate and fetch the data based on the user input.
For example: if the user enters MPS2 as input, the code should search in the entire JSON file and display the structure which contains this pattern.
So the user should get the output as below
id:MPS2 shortname:fres1 field1:76,7281.761 field2:3701.50 field3:-1.140 field4:-10.38 field5:-11 details:1 test1:589.73l url:http://www.google.com"