如何读取引用$ ref的JSON文件?

时间:2017-10-12 11:45:41

标签: java json jackson

{
  "description": "Something",
  "id": "abc.def.xyzjson#",
  "type": "object",
  "properties": {
    "triggerTime": {
      "description": "Something",
      "$ref": "abc.def.xyz.1.json#"
      "required": true
    },
    "customerId": {
      "type": "string",
      "description": "Something",
      "$ref": "abc.def.xyz.1.json#"
    },

.....更多钥匙........ 我需要进入$ ref文件位置并将json放入映射中 请帮我看看如何阅读。 我已经能够读取主文件,如

File jsonInputFile = new File("location");
System.out.println("Keys : " + entry2.getKey());

1 个答案:

答案 0 :(得分:0)

您可以尝试以下代码获取$ ref值

:
customer_name
:
(...)
order_id
:
(...)
product_name
:
(...)
qty
:
(...)
store_id
:
(...)
variation
:
"[{"id": 35, "key": "choose-your-cake", "value": "Naked"}, {"id": 36, "key": "choose-sugar", "value": "Yes"}]"

输出

  

abc.def.xyz.1.json#