– Text Object Notation


TXON – Text Object Notation – is a minimal format for embedding structured data into any text readably and unobtrusively. It is like a specialised reduction of JSON to more closely fit general text (or like a variant of INI to more closely fit nested objects).

A Python implementation to read and write TXON, and translate to/from JSON, is supplied. The core is less than 100 lines of basic code, and could be easily translated.



TXON is a nestable key-value syntax structure: like a simplified JSON with only strings and objects, and a different textual representation. The basic structure is:


This can be nested:

name1:` name2:`nested value` `

And, names are optional and need not be unique, text content may be included alongside terms, and any layout is allowed:

    JSON – :`http://json.org/`
    Scribe – :`http://en.wikipedia.org/wiki/Scribe_(markup_language)`
    INI – :`http://en.wikipedia.org/wiki/INI_file`
    Lua – :`http://lua.org/`

Outside an expression, only the sequence of : followed by ` is special and not generally allowed (this pair is what makes TXON terms findable in text). Inside an expression, ` is special and not generally allowed, unless escaped with \ . Note that this rudimentary escaping implies a certain feature: strings cannot end with a \ .


ABNF (RFC 2234)
term   = [name] ":`" value "`"
value  = *(string / term)
name   = 1*(non-blank UTF8 char, except `)
string = 1*(UTF8 char, except ` unless escaped with \)
EBNF (ISO/IEC 14977)
term   = [name], ":`", value, "`" ;
value  = {string | term}
name   = non-blank UTF8 chars, except `
string = UTF8 chars, except ` unless escaped with \


Download:` http://www.hxa.name/txon/txon.py.txt `


  • readTxon   : text with TXON → native data structure
  • writeTxon   : native data structure → string of TXON
  • translateTxonToJson   : text with TXON → string of JSON
  • translateJsonToTxon   : string of JSON → string of TXON


  • text with TXON → string of JSON
  • string of JSON → string of TXON

(MIT License.)


Why? – A little experiment to make a form of ‘digital punctuation’: a normal textual convention that is also easily parseable. (Printed text has, over the centuries, developed various metadata-like conventions, for sentences, sections, headings, etc. – so why not have something fitted to modern tech, something more machine readable . . .)


  • Scribe's basic representation: from this: @name(value), move the @ next to the ( – which is also like INI: name="value".
  • JSON's simple hierarchical ‘object notation’
  • Lua's merged array and dictionary literals: both are grouped by { }.

And, the two chars, : and `, are chosen to be:

  • ASCII, so most portable;
  • a recognisable ‘marker’ as a pair, being otherwise unlikely in text;
  • echoing normal english punctuation of ‘announcing’ quoted ‘content’.


   title:`TXON - Text Object Notation`
   creator:`Harrison Ainsworth / HXA7241`


   description:`Definition of a minimal format for embedding structured data
      into any text readably and unobtrusively.`
   subject:`data format, text, JSON, software, python`

   type:`technical article`
   rights:`Creative Commons BY-SA 3.0 License.`
   rights:`MIT License.`