json#

The JSON API in the same JAR as the typed API. Its input uses snake_case field names (start_date, calendar_id, type) and lowercase enum spellings. Every type here is in the org.dhtmlx.plen package.

  • JsonProject wraps a Project behind a string API. Each operation takes JSON text and returns an envelope string.
  • JsonProjectException is thrown by new JsonProject(optionsJson) when the options JSON is invalid. It carries the error envelope and the underlying PlenException.
  • Wire has the same operations as static methods on a typed Project, the one-shot Wire.schedule, and helpers that build envelopes from a typed result or an exception. Use it to mix typed and JSON calls on one project.
  • Decode turns JSON text or a parsed tree into the typed records (ProjectData, SolveOptions, SchedulingChanges, ...).
  • Encode writes a typed result as its JSON text.
  • Json is the strict parser and canonical writer the other types use.

A success envelope is {"ok":true,"result":...}. A failure is {"ok":false,"error":{"kind","message","path","code"}}, where kind is parse, validation or project. The envelope operations catch PlenException and return it as an error envelope. Other exceptions, such as NullPointerException, propagate. For a full request and response round trip, see Exchange JSON with a client.

  • DecodeStatic methods that turn JSON text or a parsed JSON tree into the typed records
  • EncodeWrites a typed result as the JSON text that the envelope operations return
  • JsonStrict JSON parser and canonical JSON writer over plain Java maps, lists and numbers
  • JsonProjectA Project behind a string API that takes JSON text and returns envelope strings
  • JsonProjectExceptionThrown by the JsonProject constructor when the options JSON is invalid, carrying the error envelope and the underlying PlenException
  • WireStatic JSON entry points that run engine calls on JSON text and return the result as a {ok, result | error} envelope string