如何使用Retrofit 2和Kotlin解析没有键值的json响应?

时间:2019-07-01 14:02:20

标签: json parsing kotlin retrofit2

我正在使用“ clinicaltables.nlm.nih.gov” api在我的android / kotlin应用程序中搜索药物。我将如何使用Retrofit 2进行解析?它没有标准的key:value数据。我尝试将类型设置为JsonObject,JsonArray和String。我真的不知道该怎么做。任何帮助,将不胜感激。

[
   11,
   [
  "Ibuprofen (Oral Pill)",
  "HYDROcodone/Ibuprofen (Oral Pill)",
  "Ibuprofen (Oral Liquid)",
  "Ibuprofen/oxyCODONE (Oral Pill)",
  "Ibuprofen (Chewable)",
  "Ibuprofen (Injectable)",
  "Ibuprofen/Pseudoephedrine (Oral Pill)"
   ],
   {
  "STRENGTHS_AND_FORMS":[
     [
        "100 mg Tab",
        "200 mg Cap",
        "200 mg Tab",
        "400 mg Tab",
        "600 mg Tab",
        "800 mg Tab"
     ],
     [
        " 2.5-200 mg Tab",
        " 5-200 mg Tab",
        " 7.5-200 mg Tab",
        "10-200 mg Tab"
     ],
     [
        " 40 mg/ml Susp",
        "100 mg/5ml Susp"
     ],
     [
        "400-5 mg Tab"
     ],
     [
        " 50 mg Tab",
        "100 mg Tab"
     ],
     [
        " 10 mg/ml Injection 2 ml",
        "100 mg/ml Injection 8 ml"
     ],
     [
        "200-30 mg Cap",
        "200-30 mg Tab"
     ]
  ]
 },
 [
  [
     "Ibuprofen (Oral Pill)"
  ],
  [
     "HYDROcodone/Ibuprofen (Oral Pill)"
  ],
  [
     "Ibuprofen (Oral Liquid)"
  ],
  [
     "Ibuprofen/oxyCODONE (Oral Pill)"
  ],
  [
     "Ibuprofen (Chewable)"
  ],
  [
     "Ibuprofen (Injectable)"
  ],
  [
     "Ibuprofen/Pseudoephedrine (Oral Pill)"
  ]
 ]
]

0 个答案:

没有答案