Class JsonConverter

java.lang.Object
com.badlogic.gdx.utils.Json
squidpony.store.json.JsonConverter
Direct Known Subclasses:
DataConverter

public class JsonConverter
extends com.badlogic.gdx.utils.Json
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 
    Modifier and Type Field Description
    static Object INVALID  
  • Constructor Summary

    Constructors 
    Constructor Description
    JsonConverter()
    Creates a new JsonConverter using "minimal" output type, so it omits double quotes whenever possible but gives up compatibility with most other JSON readers.
    JsonConverter​(com.badlogic.gdx.utils.JsonWriter.OutputType outputType)
    Creates a new JsonConverter 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

    Modifier and Type Method Description
    static void initialize​(com.badlogic.gdx.utils.Json json)  

    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
  • Field Details

  • Constructor Details

    • JsonConverter

      public JsonConverter()
      Creates a new JsonConverter 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.
    • JsonConverter

      public JsonConverter​(com.badlogic.gdx.utils.JsonWriter.OutputType outputType)
      Creates a new JsonConverter 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
  • Method Details