首页 > 解决方案 > Json object, convert json array into a json object in java

问题描述

I have one json array like this

"values":[
  {
    "locale":"en_US",
    "source_key":"book_format",
    "value":"Hardback",
    "display_attr_name":"Book Format",
    "source_value":"Hardback",
    "isPrimary":"true"
  },
  {
    "isFacetValue":"true",
    "facet_version":"1.1",
    "locale":"en_US",
    "value":"Hardcover"
  }
]

I need to get the only the distinct keys from above json array

{
  "locale":"en_US",
  "source_key":"book_format",
  "value":"Hardback",
  "display_attr_name":"Book Format", 
  "source_value":"Hardback",
  "isPrimary":"true",
  "isFacetValue":"true",
  "facet_version":"1.1"
}

And the output will be in the form of jsonobject.

标签: javajson

解决方案


推荐阅读