Data Types - Mrcarrot1/KarrotObjectNotation GitHub Wiki

As of KON 1.0, multiple data types are supported.

KON's supported data types are:

  • int (%)
  • uint (%^)
  • short (~)
  • ushort (~^)
  • long (&)
  • ulong (&^)
  • BigInteger (&*)
  • float (!)
  • double (#)
  • bool (@)
  • string ($)
  • null

KON supports two different methods of declaring values with numeric or boolean types. The first is implicit, in which the parser will choose the data type it thinks is best for the given value. The second is explicit, in which the user declares what data type should be used. Each type has a one-or-two-character identifier, listed above. To declare a value's type, simply put the type identifier at the beginning of the key or array line. Note that the parser will strip this identifier from the key before adding it to the KONNode object.

To disable implicit typing, use the setting KONParserOptions.AllowImplicitTyping. As of KON 1.1.4, you may also wish to set KONWriterOptions.AllExplicitTypes so that the files you write can be read with the correct data types.

In the code, some changes have been made to support multiple data types. While nodes and arrays used to have string values, they now have object values. To use a value with its correct type, simply use a cast.