• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Std/io
      • Oslib
      • Bridge
        • Json-encoding
          • Json-encode-main
            • Json-encode-true-list
            • Json-encode-simple-alist
            • Json-encode-improper-cons-list
          • Json-encode-weird-char
          • Json-encode-atom
          • Json-encode
          • Json-encode-chars
          • Json-encode-char
          • Json-encode-str
          • Json-simple-alist-p
          • Json-comma-and-maybe-newline
        • Security
        • Command
        • In-main-thread
        • Message
        • Start
        • Bindings
        • Stop
        • Try-in-main-thread
      • Clex
      • Tshell
      • Unsound-eval
      • Hacker
      • ACL2s-interface
      • Startup-banner
      • Command-line
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Json-encoding

Json-encode-main

Main function for JSON encoding.

Signature
(json-encode-main x acc) → *
Arguments
x — Any arbitrary ACL2 object.
acc — Accumulator, characters in reverse order.

(json-encode x) accumulates the JSON encoding of x onto acc. That is, acc is extended with the reverse-order characters for x's encoding in reverse order.

This function does not necessarily produce a valid JSON object. Per the JSON RFC, plain JSON values other than arrays and objects are not valid JSON text. See json-encode instead, for a function that does something to fix up atoms.

Theorem: character-listp-of-json-encode-main

(defthm character-listp-of-json-encode-main
  (implies (character-listp acc)
           (character-listp (json-encode-main x acc))))

Theorem: character-listp-of-json-encode-simple-alist

(defthm character-listp-of-json-encode-simple-alist
  (implies (and (character-listp acc))
           (character-listp (json-encode-simple-alist x acc))))

Theorem: character-listp-of-json-encode-true-list

(defthm character-listp-of-json-encode-true-list
  (implies (character-listp acc)
           (character-listp (json-encode-true-list x acc))))

Theorem: character-listp-of-json-encode-improper-cons-list

(defthm character-listp-of-json-encode-improper-cons-list
 (implies (character-listp acc)
          (character-listp (json-encode-improper-cons-list x acc))))

Subtopics

Json-encode-true-list
Json-encode-simple-alist
Json-encode-improper-cons-list