I have JSON files that reference others using the reference type used by json-schema and swagger. Below is a summary of these ref format.
I've searched quite a bit and didn't find a library in C# that allows me to resolve to deserialize json that has these reference style.
Any clues on how to do this, ideally using JSON.NET?
Ref format:
- Local Reference – $ref: '#/definitions/myElement' # means go to the root of the current document and then find elements definitions and myElement one after one.
- Remote Reference – $ref: 'document.json' Uses the whole document located on the same server and in the same location.
- The element of the document located on the same server – $ref: 'document.json#/myElement'
- The element of the document located in the parent folder – $ref: '../document.json#/myElement'
- The element of the document located in another folder – $ref: '../another-folder/document.json#/myElement'
- URL Reference – $ref: 'http://path/to/your/resource' Uses the whole document located on the different server.
- The specific element of the document stored on the different server – $ref: 'http://path/to/your/resource.json#myElement'
- The document on the different server, which uses the same protocol (for example, HTTP or HTTPS) – $ref: '//anotherserver.com/files/example.json'