简体   繁体   English

如何在JAVA中的JSONObject中搜索JSONArray

[英]how to search a JSONArray inside the JSONObject in JAVA

I have a JSONObject which inturn contains two JSONObjects ( key is rows_map and columns_map) 我有一个JSONObject,它依次包含两个JSONObjects(键是rows_map和columns_map)

    {
        "rows_map":{
        "3":["Test","Test","Test","Test","Test",null,null,null,null,null,"2011-10-07 15:47:56.0",null,null],
        "2":["test","","","","",null,null,null,"123456789","123456789.user","2011-10-07 12:49:49.0",null,null]
    },
        "columns_map":{
columns_map":"fld1","fld2","fld3","fld4","fld5","Latitude","Longitude","Altitude","Mobile Number","Name","Time","Message","Advertisment"]
        }
    }

In rows_map 3 and 2 are record numbers. 在rows_map 3和2中是记录编号。 Each record is related to columns in columns_map. 每个记录都与columns_map中的列相关。 I want to get records list based on mobile number column for eg: recordslist of mobilenumber equal to 123456789 我想获取基于手机号码列的记录列表,例如:mobilenumber的recordslist等于123456789

How can i do this. 我怎样才能做到这一点。

In the case that you're trying to read a json using java, you should be parsing it as an object rather than via syntax. 如果您尝试使用Java读取json,则应将其解析为对象,而不是通过语法。 Take a look at: https://stackoverflow.com/questions/338586/a-better-java-json-library 看一下: https : //stackoverflow.com/questions/338586/a-better-java-json-library

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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