as library (jsonknife)

  • access by json pointer
  • custom data loader

access by json pointer

access data by json pointer, you can use two functions, below.

  • access_by_json_pointer
  • assign_by_json_pointer

result

keyname within “/”

result

custom data loader

Making your custom data loader, such as below.

  • $include keyword for including extra files’s contents

So, if you want to include extra data, you can do via $include.

main:
  subdata:
    $include <extra file path>

how to use it.

$ python loader.py main.yaml > loader.output

input data are like below.

main.yaml

person.yaml

name.yaml

age.yaml

loaded data

code

loader.py

another example

Resolver’s constructor has onload argument, this is the hook called when loading data. you can make another version of custom data loader(almost same behavior), using this hook.