classafJson::JsLiteral

sys::Obj
  afJson::JsLiteral

@Js
@Serializable { simple=true }

A value that is written out verbatim by JsonWriter.

Use JsLiterals to embed Javascript in your JSON objects. Note that the resultant string is no longer valid JSON, but can sometimes be a good get out of jail card.

jsonWriter.writeJson([
  "func" : JsLiteral("function() { ... }")
])

// --> { "func" : function() { ... } }

Note that without JsLiteral, the function would be surrounded in quotes:

jsonWriter.writeJson([
  "func" : "function() { ... }"
])

// --> { "func" : "function() { ... }" }
fromStr

Source

new fromStr(Str val)

Creates a JsonLiteral.

val

Source

Str val

The literal value.