Java Code Examples for com.badlogic.gdx.utils.Json#setQuoteLongValues()
The following examples show how to use
com.badlogic.gdx.utils.Json#setQuoteLongValues() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StringGenerator.java From gdx-fireapp with Apache License 2.0 | 5 votes |
public static String dataToString(Object object) { if (isPrimitiveType(object)) return object.toString(); Json json = new Json(); json.setTypeName(null); json.setQuoteLongValues(false); json.setIgnoreUnknownFields(true); json.setOutputType(JsonWriter.OutputType.json); return json.toJson(object); }
Example 2
Source File: MapTransformer.java From gdx-fireapp with Apache License 2.0 | 5 votes |
static String mapToJSON(Map<String, Object> map) { Json json = new Json(); json.setTypeName(null); json.setQuoteLongValues(true); json.setIgnoreUnknownFields(true); json.setOutputType(JsonWriter.OutputType.json); return json.toJson(map, HashMap.class); }
Example 3
Source File: JsonDataModifier.java From gdx-fireapp with Apache License 2.0 | 5 votes |
/** * Returns modified json data. * * @param oldJsonData Old data as json string. * @return New data as json string */ @SuppressWarnings("unchecked") public String modify(String oldJsonData) { T oldData = JsonProcessor.process(wantedType, oldJsonData); T newData = (T) transactionFunction.apply(oldData); Json json = new Json(); json.setTypeName(null); json.setQuoteLongValues(true); json.setIgnoreUnknownFields(true); json.setOutputType(JsonWriter.OutputType.json); return json.toJson(newData, wantedType); }
Example 4
Source File: MapConverter.java From gdx-fireapp with Apache License 2.0 | 5 votes |
public <T> T convert(Map<String, Object> map, Class<T> wantedType) { try { String jsonString = new Json().toJson(map); Json json = new Json(); json.setIgnoreUnknownFields(true); json.setTypeName(null); json.setQuoteLongValues(true); return json.fromJson(wantedType, jsonString); } catch (Exception e) { GdxFIRLogger.error("Can't deserialize Map to " + wantedType.getSimpleName(), e); return null; } }
Example 5
Source File: MapConverter.java From gdx-fireapp with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public Map<String, Object> unConvert(Object object) { try { String jsonString = new Json().toJson(object); Json json = new Json(); json.setIgnoreUnknownFields(true); json.setTypeName(null); json.setQuoteLongValues(true); return json.fromJson(HashMap.class, jsonString); } catch (Exception e) { GdxFIRLogger.error("Can't serialize " + object.getClass().getSimpleName() + " to Map.", e); return null; } }