2 Pengine libraries
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • Pengines: Web Logic Programming Made Easy
        • Pengine libraries
          • library(pengines): Pengines: Web Logic Programming Made Easy
          • library(term_to_json)
            • term_to_json/3
            • term_to_json/2

2.2 library(term_to_json)

[det]term_to_json(+Term, +Bindings, -JsonTerm)
[det]term_to_json(+Term, -JsonTerm)
Convert any general Prolog term into a JSON term. Prolog lists are treated in a special way. Also, JSON terms are not converted. Mapping:

  • Variable: {"type":"var", "name":<string>}
  • Atom: {"type":"atom", "value":<string>}
  • Integer: {"type":"integer", "value":<integer>}
  • Float: {"type":"float", "value":<float>}
  • List: JSON array
  • Dict: a JSON object. Values are processed recursively. (the tag is ignored)
  • json([Key=Value, ...]): a JSON object Values are processed recursively.
  • compound: {"type":"compound", "functor":<string>, "args":<array>}
Bindings is a list of Name=Var terms for variables that get their name from the environment.

Index

?
add_error_details/3
authentication_hook/3
current_pengine_application/1
event_to_json/3
not_sandboxed/2
output/2
pengine_abort/1
pengine_application/1
pengine_ask/3
pengine_create/1
pengine_debug/2
pengine_destroy/1
pengine_destroy/2
pengine_done/0
pengine_event_loop/2
pengine_input/2
pengine_next/2
pengine_output/1
pengine_property/2
pengine_pull_response/2
pengine_respond/3
pengine_rpc/2
pengine_rpc/3
pengine_self/1
pengine_stop/2
pengine_user/1
portray_blob/2
prepare_goal/3
prepare_module/3
prompt/3
term_to_json/2
term_to_json/3
thread_pool:create_pool/1
write_result/3