001package squidpony; 002 003import com.badlogic.gdx.utils.JsonWriter; 004import squidpony.store.json.JsonConverter; 005/** 006 * Augmented version of LibGDX's Json class that knows how to handle various data types common in SquidLib. 007 * This includes OrderedMap, which notably allows non-String keys (LibGDX's default Map serializer requires keys to be 008 * Strings), but does not currently allow the IHasher to be set (which only should affect OrderedMaps with array keys). 009 * It also makes significantly shorter serialized output for 2D char arrays, GreasedRegion and FakeLanguageGen objects, 010 * and various collections (IntDoubleOrderedMap, IntVLA, Arrangement, K2, and K2V1 at least). 011 * Created by Tommy Ettinger on 1/9/2017. 012 */ 013public class DataConverter extends JsonConverter { 014 /** 015 * Creates a new DataConverter using "minimal" output type, so it omits double quotes whenever possible but gives 016 * up compatibility with most other JSON readers. Give the constructor 017 * {@link JsonWriter.OutputType#json} if you need full compatibility. 018 */ 019 public DataConverter() { 020 super(); 021 } 022 023 /** 024 * Creates a new DataConverter with the given OutputType; typically minimal is fine, but compatibility may require 025 * you to use json; the javascript type is a sort of middle ground. 026 * @param outputType a JsonWriter.OutputType enum value that determines what syntax can be omitted from the output 027 */ 028 public DataConverter(JsonWriter.OutputType outputType) { 029 super(outputType); 030 } 031}