7.2 library(http/json_convert): Convert between JSON terms and Prolog application terms
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • Supporting JSON
          • library(http/json_convert): Convert between JSON terms and Prolog application terms
            • current_json_object/3
            • json_object/1
            • prolog_bool_to_json/2
            • prolog_to_json/2
            • json_to_prolog/2
Availability::- use_module(library(http/json_convert)).
Source[det]json_to_prolog(+JSON, -Term)
Translate a JSON term into an application term. This transformation is based on :- json_object/1 declarations. An efficient transformation is non-trivial, but we rely on the assumption that, although the order of fields in JSON terms is irrelevant and can therefore vary a lot, practical applications will normally generate the JSON objects in a consistent order.

If a field in a json_object is declared of type boolean, @true and @false are translated to true or false, the most commonly used Prolog representation for truth-values.