简体   繁体   中英

parse a string to extract specified content in java

I need to extract NSID from a list of string which is stored in a file.the string look like this. the string inside jsonFlickrApi() is in json format.

007rebecca@gmail.com|jsonFlickrApi({"user":{"id":"21849273@N06", "nsid":"21849273@N06", "username":{"_content":"eire5555"}}, "stat":"ok"})

If I want to parse this and get the nsid, in java what approach i should take. Should I write a parser or is there any library available to parse this json inside jsonFlickrAPI()

The string is a mix of a json and some other text. You may try to split the json part and then can use a json parser to retrieve nsid easily.There are various java json parsers available such as GSON .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM