java - Prase string and save it as key value pair -
I want to parse this string and get value based on value such as application_id key and 123456 value Please help in java code
string teststring = "\" application_id \ ": \" 123456 \ ", \" application_name \ ": \" Shitanshu / train ticket book \ ", \ "AppStore_ID \": \ "89 \", \ "Google Play Store \", \ "version \": \ "1.1 \", \ "Rating \": \ "5 \", \ "title \": \ "Empty \", \ "Comment \": \ "Really Recharging ... En The words are also fast ... \ ", \" user \ ": \" narasimham sai \ ", \" date \ ": \" 2014-07-29 \ ", \" time \ ": \" 20: 53:34 \ ", \" iso_code \ ": \" weak \ ", \" COUNTRY_NAME \ ": \" weak \ ", \" label \ ": \" [] \ ""; Divide the string on
,
, split the pair < Code>: :
Maps & lt; String, string & gt; TheMap = New Hashmop & lt; & Gt; (); String [] pairs = testString.split (","); (String pair: pair) {string [] parts = pair.Reliform ("\" "," ") .split (": "); theMap.put (part [0], part [1]);} system. Out.println (theMap.get ("application_id");
Output:
123456
Comments
Post a Comment