Jsonata Fluid Value

Class Library
C#
GitHub Gist

What It Is

A Fluid value to extract data from JSON to query or output into a Fluid template

Status

Last Reviewed:

I use it on this site. Honestly, there is very little code in this class – most of the logic is in the underlying JsonataDoc code.

Details

This is a Fluid value to extract data from JSON to query or output into a Fluid template.

.query returns an ArrayValue of JsonataValue objects.

var json = GetABunchOfJsonFromSomewhere();
templateContext.SetValue("json", new JsonValue(json));

.value will always return the value as a string.

<ul>
{% for item in json.query("$.data.items") %}
  <li>{{ item.value("$.title") }}</li>
{% endfor %}
</ul>

Again, this just wraps my JSONata wrapper, so anything that works there will probably work here too.