如何解析给定的json格式?

时间:2019-02-27 06:31:50

标签: java json

{ installedApplications { id: 16 aid: 4539749 appName: "A31-RT1" description: "A31-RT1" applicationLogoUrl: "/applications/16/applicationlogo" applicationCompanyOrBusinessLogoUrl: "/applications/16/companyorbusinesslogo" appProviderName: "" appProviderPersoEndpointUrl: "" appProviderDeleteEndpointUrl: "" androidAppPackageName: "N" isUnpublished: false isInstallationAllowed: true isApprovedForSharedSlot: false lastUpdatedDate: -1 contactEmail: "pallavi.shanmukhaiah@nxp.com" linkToTermsAndConditions: "" linkToApplicationWebsite: "" applicationSize: 288 businessSegment: "Infrastructure" supportedCardLogoUris: "/applications/3/supportedcards/53/cardlogo" 21: 0 }
 我尝试了很多次,但是我无法超出ID和帮助范围?
请帮助我编写代码以解析此json格式。

1 个答案:

答案 0 :(得分:0)

JSONObject obj = new JSONObject();

您拥有obj,所以请像这样

int id = (int) obj.getJSONObject("installedApplications").get("id");
int aid = (int) obj.getJSONObject("installedApplications").get("aid");

我希望这会有所帮助。