title: json reference extraction in python
body: <p>Json is not only useful as a communication tool for APIs, but also may be used as a markup for configuring running programs as initialization. </p>
  
  <p>I encountered the use of <a href="https://json-schema.org/understanding-json-schema/structuring.html#reuse" rel="noreferrer">references in json schema for the purpose of reuse</a>. </p>
  
  <p>Since json schema is valid json, I had expected the python json library to have the ability to expand references.</p>
  
  <pre><code>$ cat test.json
  { 
    "template":{
      "a":"a",
      "b":"b",
      "pi":3.14
    },
    "value": { "$ref":"#/template"}
  }
  python -c "from json import load; fp = open(\"test.json\",\"r\"); print(load(fp))"
  {'template': {'a': 'a', 'b': 'b', 'pi': 3.14}, 'value': {'$ref': '#/template'}}
  </code></pre>
  
  <p>What is the simplest way to expand the references in python, since python dicts cannot point to other parts of themselves (I think)? </p>