Item:OSWf1df064239044b8fa3c968339fb93344: Difference between revisions

From OpenSemanticWorld
m
Protected "JSON Tutorial": Protected as read-only import via Page Exchange extension ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) [cascading]
(Install package: OSW Docs - Core)
 
m (Protected "JSON Tutorial": Protected as read-only import via Page Exchange extension ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) [cascading])
 
(3 intermediate revisions by the same user not shown)
Line 78: Line 78:
</syntaxhighlight>
</syntaxhighlight>


==JSON Documents: Pointer (1)==
==JSON Documents: Pointer==


Pointer allow reference to
Pointer allow reference to
Line 100: Line 100:


<nowiki>#</nowiki>/kids/0 - the first item within the array "kids"
<nowiki>#</nowiki>/kids/0 - the first item within the array "kids"
==JSON Documents: Pointer (2)==
==JSON Documents: Reference==
Pointer allow reference to
References allow reference to
*An object within the JSON document
*An external JSON document
*An external JSON document
*Combined with a pointer: An object within the external JSON document


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Line 111: Line 111:
     "partner": {
     "partner": {
         "$ref": "http://www.personaldata.com/walter.birch.json"
         "$ref": "http://www.personaldata.com/walter.birch.json"
    },
    "partner_firstname": {
        "$ref": "http://www.personaldata.com/walter.birch.json#firstname"
     }
     }
}
}
</syntaxhighlight>Specification: [http://jsonref.org/]
==JSON Documents: Path==
Paths allow query / filter values within a JSON document<syntaxhighlight lang="json">
{
  "store": {
    "book": [
      { "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
      { "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ]
  }
}
</syntaxhighlight>
*$.store.book[*].price => [8.95, 22.99]
*$.store.book[?(@.title == 'The Lord of the Rings')].price => 22.99
Specification: [https://datatracker.ietf.org/doc/html/rfc9535]
Conceptually also available as AWS S3 Select[https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-select-sql-reference-select.html] and Postgres JSONB [https://www.postgresql.org/docs/current/datatype-json.html#JSON-CONTAINMENT]
== JSON vs. YAML ==
YAML version 1.2 is a superset of JSON with a simplified syntax
<div style=" column-count: 2;">
<div>JSON (more machine-friendly)
<syntaxhighlight lang="json">
{
  "store": {
    "book": [
      { "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
      { "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ]
  }
}
</syntaxhighlight>
</div>
<div>YAML (more human-friendly)
<syntaxhighlight lang="yaml">
# comments are allowed
store:
  book:
  - author: Nigel Rees
    title: Sayings of the Century
    price: 8.95
  - author: J. R. R. Tolkien
    title: The Lord of the Rings
    isbn: 0-395-19395-8
    price: 22.99
</syntaxhighlight>
</syntaxhighlight>
</div>
</div>


==JSON Documents: Next==
==JSON Documents: Next==


*[[Item:OSWf4a9514baed04859a4c6c374a7312f10]] [{{fullurl:Item:OSWf4a9514baed04859a4c6c374a7312f10|reveal=true}} Slideshow]
*[[Item:OSWf4a9514baed04859a4c6c374a7312f10]] [{{fullurl:Item:OSWf4a9514baed04859a4c6c374a7312f10
*[[Item:OSW911488771ea449a6a34051f8213d7f2f]] [{{fullurl:Item:OSW911488771ea449a6a34051f8213d7f2f|reveal=true}} Slideshow]
|reveal=true
}} Slideshow]
*[[Item:OSW911488771ea449a6a34051f8213d7f2f]] [{{fullurl:Item:OSW911488771ea449a6a34051f8213d7f2f
|reveal=true
}} Slideshow]
jsondata
Line 1: Line 1:
{
{
    "required_predecessor": [],
"type": [
    "optional_predecessor": [],
"Category:OSW494f660e6a714a1a9681c517bbb975da"
    "recommended_successor": [
],
        "Item:OSWf4a9514baed04859a4c6c374a7312f10",
"uuid": "f1df0642-3904-4b8f-a3c9-68339fb93344",
        "Item:OSW911488771ea449a6a34051f8213d7f2f"
"label": [
    ],
{
    "type": [
"text": "JSON Tutorial",
        "Category:OSW494f660e6a714a1a9681c517bbb975da"
"lang": "en"
    ],
}
    "uuid": "f1df0642-3904-4b8f-a3c9-68339fb93344",
],
    "name": "JsonTutorial",
"description": [
    "label": [
{
        {
"text": "Covers basics about JSON-Documents",
            "text": "JSON Tutorial",
"lang": "en"
            "lang": "en"
}
        }
],
    ],
"required_predecessor": [],
    "description": [
"optional_predecessor": [],
        {
"recommended_successor": [
            "text": "Covers basics about JSON-Documents",
"Item:OSWf4a9514baed04859a4c6c374a7312f10",
            "lang": "en"
"Item:OSW911488771ea449a6a34051f8213d7f2f"
        }
],
    ],
"name": "JsonTutorial",
    "image": "File:OSW2055124fe7b344148a1baad537bf8e35.png"
"image": "File:OSW2055124fe7b344148a1baad537bf8e35.png",
"part_of": [
"Item:OSWae8546dad40e487fa837db9c5ab07a5f"
]
}
}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.