Class JsonExpr
- Namespace
- Invex.StructuredText.Expressions
- Assembly
- Invex.StructuredText.dll
An expression whose value is an object, an array, or of a type not known statically.
public abstract record JsonExpr : Expr
- Inheritance
-
objectJsonExpr
- Derived
- Inherited Members
Remarks
Navigate with the indexers and convert with AsString(), AsBool() or AsNumber() when the value's type is known.
Constructors
JsonExpr()
protected JsonExpr()
Properties
this[int]
Accesses an element of this array.
public JsonExpr this[int index] { get; }
Parameters
indexintThe zero-based index.
Property Value
this[string]
Accesses a property of this object. The name is a single key: it may contain dots or spaces, and the
printer uses ['name'] syntax where .name isn't valid.
public JsonExpr this[string property] { get; }
Parameters
propertystringThe property name.
Property Value
Methods
AsBool()
Treats this value as a boolean.
public BoolExpr AsBool()
Returns
AsNumber()
Treats this value as a number.
public NumberExpr AsNumber()
Returns
AsString()
Treats this value as a string.
public StringExpr AsString()
Returns
Contains(Expr)
Tests whether this array contains the element value. To search text, convert with
AsString() and use Contains(StringExpr).
public BoolExpr Contains(Expr value)
Parameters
valueExprThe element to search for.
Returns
Join(StringExpr?)
Joins the elements of this array with separator.
public StringExpr Join(StringExpr? separator = null)
Parameters
separatorStringExprThe separator; the platform default when null.
Returns
ToJson()
Serializes this value to JSON text.
public StringExpr ToJson()