Änderungen

Zur Navigation springen Zur Suche springen
2.669 Bytes hinzugefügt ,  11:21, 22. Jun. 2023
Zeile 3: Zeile 3:  
Siehe auch  
 
Siehe auch  
 
* [[Java-Tipps#JSON]]
 
* [[Java-Tipps#JSON]]
 +
 +
== Auswertung in der Shell ==
 +
 +
=== mit Hilfe von jq ===
 +
 +
Mit dem Paket <code>jq</code> gibt es ein Tool zur Auswertung von JSON auf der Kommandozeile:
 +
  echo '{"error":{"code":"assertuserfailed","info":"Assertion that the user is logged in failed"}}' | jq -r '.error.code'
 +
 +
erzeugt
 +
  assertuserfailed
 +
 +
Siehe
 +
* [https://stedolan.github.io/jq/manual/#Basicfilters JQ-Manual]
 +
* https://programminghistorian.org/en/lessons/json-and-jq
 +
 +
=== mit Hilfe von Miller (mlr) ===
 +
 +
Siehe https://miller.readthedocs.io/en/latest/
 +
 +
=== mit Hilfe von Visidata ===
 +
 +
Visidata ist ein Datenviewer mit einer Text-Benutzeroberfläche (TUI) im Terminal.
 +
 +
Siehe
 +
* https://www.visidata.org/
    
== Schöne Ausgabe auf Kommandozeile ==
 
== Schöne Ausgabe auf Kommandozeile ==
Um eine für den Menschen leicht lesbare Ausgabe zu haben, kann man das mit [[Python]] mitgelieferte Skript <code>json.tool</code> nutzen:
+
Um eine für den Menschen leicht lesbare Ausgabe von JSON zu haben, kann man das mit [[Python]] mitgelieferte Skript <code>json.tool</code> nutzen:
    
   echo '{"error":{"code":"assertuserfailed","info":"Assertion that the user is logged in failed"}}' | python -m json.tool
 
   echo '{"error":{"code":"assertuserfailed","info":"Assertion that the user is logged in failed"}}' | python -m json.tool
Zeile 16: Zeile 41:  
     }
 
     }
 
   }
 
   }
 +
 +
== Änderungen von JSON-Data ==
 +
 +
=== JSONPatch ===
 +
[http://jsonpatch.com/ JsonPatch] ist ein JSON-Datenformat zur Darstellung von Änderungen an einem JSON-Datentyp.
 +
Siehe dazu auch
 +
* https://www.npmjs.com/package/fast-json-patch
 +
* https://github.com/sonnyp/JSON8/tree/main/packages/patch
 +
* https://www.npmjs.com/package/rfc6902
 +
* https://github.com/cujojs/jiff ([https://www.npmjs.com/package/jiff npm jiff])
 +
* [https://github.com/Starcounter-Jack/JSON-Patch Javascript-Implementierung von JsonPatch]
 +
* http://jsonpatchjs.com/
 +
* [https://tools.ietf.org/html/rfc6902 RFC6902]
 +
* https://jsonpatch.com/
 +
* [https://github.com/streamich/json-joy/tree/master/src/json-patch Json-Patch] als Teil der [https://github.com/streamich/json-joy Json-Joy]-Initiative.
 +
* https://github.com/josdejong/immutable-json-patch
 +
 +
* https://github.com/benjamine/jsondiffpatch
 +
* https://www.npmjs.com/package/deep-diff
 +
 +
 +
Eine rudimentäre Implementierung gibt es auch für [[Postgres]]:
 +
* https://gist.github.com/InfoSec812/b830a9db4c9048552f8c51d7987cc4d0#file-jsonb_patch-sql-L46
 +
 +
==== JSONWatch ====
 +
Mit [https://github.com/dbohdan/jsonwatch JsonWatch] können Änderungen eines JSON-Datentyps auf einer URL regelmäßig überwacht werden. Die Änderungen werden als JSON-Änderungen ausgegeben.
 +
 +
== Abfragen von JSON ==
 +
 +
=== JSONAPI ===
 +
Basierend auf REST-Abfragen wurde die [https://jsonapi.org/ JSONAPI] entwickelt.
 +
 +
=== GraphQL ===
 +
 +
Abweichend von REST hat Facebook einen Standard für Datenabfragen namens GraphQL entwickelt. Dafür gibt es eine Vielzahl von Adaptern, z.B.
 +
* [https://hasura.io/ Hasura] - ein Open Source Layer, der Abfragen in GraphQL auf eine Postgres-Datenbank übersetzt.
 +
 +
=== JSONPath ===
 +
 +
* https://restfulapi.net/json-jsonpath/
 +
* https://www.baeldung.com/guide-to-jayway-jsonpath
 +
* https://github.com/json-path/JsonPath
 +
 +
== Rust und JSON ==
 +
 +
Siehe zum Parsen und Schreiben von JSON in [[Rust]]] beispielsweise
 +
* https://github.com/serde-rs/json
 +
* https://docs.rs/json/latest/json/
    
== MS Access und JSON ==
 
== MS Access und JSON ==

Navigationsmenü