从复杂的服务器响应中提取字段

huangapple go评论85阅读模式
英文:

Extract fields from complicated server response

问题

{ "bankAccounts": [
  {
    "id": "wfasfsd",
    "balance": { "amount": 90, "currency": "GBP" }
  }
]}

Link to StackOverflow post

英文:

I have a server response that has this format:

{"bankAccounts":[
                  {"id"     :"wfasfsd",
                   "balance":{"amount":90, "currency":"GBP"}
                  }
                ]

I cant find out how to parse through it efficiently
For a similar response with of simpler format this post helped me (https://stackoverflow.com/questions/63702281/extract-jsonobject-and-iterate-through-hashmap-field)

The picture shows exactly how the server response looks like. I need to extract this into JSON and in the end, I need to have a HashMap with keys id, amount, currency
从复杂的服务器响应中提取字段

答案1

得分: 1

你可以使用json-simple库来读取和写入JSON对象。

在这里,你可以看到如何使用它。

英文:

You can use json-simple library to read and write json objects.

Here you can see how to use it.

huangapple
  • 本文由 发表于 2020年9月2日 21:51:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/63707041.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定