Questions tagged [jsonpointer]

Standard for pointing to a specific value within a JSON document

JSON Pointer is a standard which defines a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document. It is used within other specifications such as json-patch and json-reference.

28 questions
25
votes
2 answers

Select an array member by name with a JSON Pointer

Is there a way to select an array member the value of a key with JSON Pointer? So for this JSON Schema: "links":[ { "title": "Create", "href": "/book", "method": "POST", "schema": {} }, { "title": "Get", …
jabbermonkey
  • 1,680
  • 4
  • 19
  • 37
12
votes
1 answer

How to find value with dynamic node name using Jackson and JsonPointer

I am using Jackson (version 2.6+) to parse some ugly JSON that looks like this: { "root" : { "dynamic123" : "Some value" } } The name of the attribute dynamic123 is unfortunately not known until runtime and may differ from time to…
wassgren
  • 18,651
  • 6
  • 63
  • 77
10
votes
1 answer

Map JSON-pointer to the {line, column} in a text JSON file

I need to map a location in JSON (or JavaScript object) defined by JSON-pointer to the position in JSON text file as {line,column}. Is there any existing JavaScript library that would do it? Writing this code is going to be a bit tedious... For…
esp
  • 7,314
  • 6
  • 49
  • 79
10
votes
1 answer

Purpose of tilde in JSON Pointer

The JSON Pointer spec states: the characters '~' (%x7E) and '/' (%x2F) have special meanings in JSON Pointer It is clear what '/' is used for, but I see no indication of what purpose the tilde serves (only mention that it needs to be escaped…
Brett Zamir
  • 14,034
  • 6
  • 54
  • 77
9
votes
2 answers

TypeScript type definition for an object property path

Is it possible to type an array of strings in such a way that the array can only be a valid property path in a given object? The type definition should work for all deeply nested objects. Example: const object1 = { someProperty: true }; const…
Johannes Ewald
  • 17,665
  • 5
  • 44
  • 39
7
votes
1 answer

Use object property keys as enum in JSON schema

I'm trying to validate a JSON file using JSON Schema, in order to find cases of "broken references". Essentially my file consists of items and groups, with each item belonging to a single group referenced by the groups property key, like so: { …
Simon
  • 3,667
  • 1
  • 35
  • 49
7
votes
1 answer

Wildcards and query semantics in JsonPointer with Jackson

Jackson provides JsonPointer. However, I want to do something like that what https://github.com/json-path/JsonPath can provide. How do I describe this in JsonPointer?: $.store.book[?(@.price < 10)] somethink like: JsonPointer p =…
nimo23
  • 5,170
  • 10
  • 46
  • 75
4
votes
2 answers

How to convert Object to javax.json.JsonValue?

I want to patch a JSON string. I get the 'path' to the field which has to be patched, and the 'value' with which to patch. The value could be anything, String, int, float, boolean, array, or an object. How do I convert the Object to JsonValue? The…
3
votes
1 answer

Fixing out of sync warning in Argo CD - Unable to ignore the optional `preserveUnknownFields` field

Argo CD shows two items from linkerd (installed by Helm) are being out of sync. The warnings are caused by the optional preserveUnknownFields: false in the spec section: trafficsplits.split.smi-spec.io serviceprofiles.linkerd.io But I'm not able…
RedGiant
  • 4,444
  • 11
  • 59
  • 146
3
votes
1 answer

Using a $ref and other properties within a JSON Schema

In a JSON Schema is is valid to have a $ref and then other properties within the same schema, for example. { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "title": "My schema", "properties": { …
Sprotty
  • 5,676
  • 3
  • 33
  • 52
3
votes
2 answers

Is there any way to use JSON pointers to use relative path in side JSON string?

Example : Currently we can refer name property value in address name property as below { person: { name: "a", address: { name: { "$ref":"#/person/name"}, zip:"123" } …
Atul
  • 3,013
  • 2
  • 12
  • 15
2
votes
0 answers

How can I validate a json pointer for a given Json Schema (even with $ref fields)?

I am working with a JsonSchema that utilizes nested data structures where I use $ref for some properties and for others I just write in the data structures (no $ref). Basically I have to consider many types of JsonSchema Structures. What I am trying…
2
votes
1 answer

Can you embed markdown in OpenAPI?

I presently have openapi: 3.1.0 info: title: My API version: $ref: package.json#/version description: | practically the same content as README.md Is there a way with JSON Pointers to embed text rather than JSON object? Something…
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
2
votes
2 answers

Get the line number of a JSON file given a JSON Path/JSON Pointer in Java

I am looking for a way to parse a JSON file for a specific node and get that node's line number in the file. I would like to use the Jayway JSONPath library to support extended JSONPath queries. For example (from jsonpath.com), here's some JSON: { …
tophersmith116
  • 432
  • 1
  • 5
  • 19
2
votes
1 answer

Is this a bug in the Jackson JsonParser, or am I doing something wrong?

I'm observing what appears to be some wierd behavior with the Jackson JsonParser, specifically, capturing a correct JsonPointer while in an array. Given the following JSON snippet: [ { "name": "a", "children": [ { …
Dan Lugg
  • 20,192
  • 19
  • 110
  • 174
1
2