Package squidpony

Class DataConverter

java.lang.Object
com.badlogic.gdx.utils.Json
squidpony.store.json.JsonConverter
squidpony.DataConverter

public class DataConverter
extends JsonConverter
Augmented version of LibGDX's Json class that knows how to handle various data types common in SquidLib. This includes OrderedMap, which notably allows non-String keys (LibGDX's default Map serializer requires keys to be Strings), but does not currently allow the IHasher to be set (which only should affect OrderedMaps with array keys). It also makes significantly shorter serialized output for 2D char arrays, GreasedRegion and FakeLanguageGen objects, and various collections (IntDoubleOrderedMap, IntVLA, Arrangement, K2, and K2V1 at least). Created by Tommy Ettinger on 1/9/2017.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.badlogic.gdx.utils.Json

    com.badlogic.gdx.utils.Json.ReadOnlySerializer<T extends Object>, com.badlogic.gdx.utils.Json.Serializable, com.badlogic.gdx.utils.Json.Serializer<T extends Object>
  • Field Summary

    Fields inherited from class squidpony.store.json.JsonConverter

    INVALID
  • Constructor Summary

    Constructors 
    Constructor Description
    DataConverter()
    Creates a new DataConverter using "minimal" output type, so it omits double quotes whenever possible but gives up compatibility with most other JSON readers.
    DataConverter​(com.badlogic.gdx.utils.JsonWriter.OutputType outputType)
    Creates a new DataConverter with the given OutputType; typically minimal is fine, but compatibility may require you to use json; the javascript type is a sort of middle ground.
  • Method Summary

    Methods inherited from class squidpony.store.json.JsonConverter

    initialize

    Methods inherited from class com.badlogic.gdx.utils.Json

    addClassTag, copyFields, fromJson, fromJson, fromJson, fromJson, fromJson, fromJson, fromJson, fromJson, fromJson, fromJson, getClass, getIgnoreUnknownFields, getSerializer, getTag, getWriter, ignoreUnknownField, newInstance, prettyPrint, prettyPrint, prettyPrint, prettyPrint, prettyPrint, prettyPrint, readField, readField, readField, readField, readField, readFields, readValue, readValue, readValue, readValue, readValue, readValue, readValue, setDefaultSerializer, setDeprecated, setElementType, setEnumNames, setIgnoreDeprecated, setIgnoreUnknownFields, setOutputType, setQuoteLongValues, setReadDeprecated, setSerializer, setSortFields, setTypeName, setUsePrototypes, setWriter, toJson, toJson, toJson, toJson, toJson, toJson, toJson, toJson, toJson, writeArrayEnd, writeArrayStart, writeArrayStart, writeField, writeField, writeField, writeField, writeFields, writeObjectEnd, writeObjectStart, writeObjectStart, writeObjectStart, writeObjectStart, writeType, writeValue, writeValue, writeValue, writeValue, writeValue, writeValue

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DataConverter

      public DataConverter()
      Creates a new DataConverter using "minimal" output type, so it omits double quotes whenever possible but gives up compatibility with most other JSON readers. Give the constructor JsonWriter.json(java.lang.String) if you need full compatibility.
    • DataConverter

      public DataConverter​(com.badlogic.gdx.utils.JsonWriter.OutputType outputType)
      Creates a new DataConverter with the given OutputType; typically minimal is fine, but compatibility may require you to use json; the javascript type is a sort of middle ground.
      Parameters:
      outputType - a JsonWriter.OutputType enum value that determines what syntax can be omitted from the output