Home
last modified time | relevance | path

Searched refs:toJson (Results 1 – 25 of 131) sorted by relevance

123456

/external/gson/gson/src/test/java/com/google/gson/functional/
DPrimitiveTest.java52 assertEquals("1", gson.toJson(1)); in testPrimitiveIntegerAutoboxedSerialization()
65 assertEquals("1", gson.toJson(1, byte.class)); in testByteSerialization()
66 assertEquals("1", gson.toJson(1, Byte.class)); in testByteSerialization()
67 assertEquals(Byte.toString(Byte.MIN_VALUE), gson.toJson(Byte.MIN_VALUE, Byte.class)); in testByteSerialization()
68 assertEquals(Byte.toString(Byte.MAX_VALUE), gson.toJson(Byte.MAX_VALUE, Byte.class)); in testByteSerialization()
70 assertEquals("-128", gson.toJson(128, Byte.class)); in testByteSerialization()
71 assertEquals("1", gson.toJson(1.5, Byte.class)); in testByteSerialization()
108 assertEquals("1", gson.toJson(1, short.class)); in testShortSerialization()
109 assertEquals("1", gson.toJson(1, Short.class)); in testShortSerialization()
110 assertEquals(Short.toString(Short.MIN_VALUE), gson.toJson(Short.MIN_VALUE, Short.class)); in testShortSerialization()
[all …]
DFieldExclusionTest.java45 String result = gson.toJson(target); in testDefaultInnerClassExclusion()
46 assertEquals(target.toJson(), result); in testDefaultInnerClassExclusion()
50 result = gson.toJson(target); in testDefaultInnerClassExclusion()
51 assertEquals(target.toJson(), result); in testDefaultInnerClassExclusion()
57 String result = gson.toJson(target); in testInnerClassExclusion()
64 String result = gson.toJson(target); in testDefaultNestedStaticClassIncluded()
65 assertEquals(target.toJson(), result); in testDefaultNestedStaticClassIncluded()
69 result = gson.toJson(target); in testDefaultNestedStaticClassIncluded()
70 assertEquals(target.toJson(), result); in testDefaultNestedStaticClassIncluded()
88 public String toJson() { in toJson() method in FieldExclusionTest.NestedClass
DArrayTest.java49 assertEquals("[1,2,3,4,5,6,7,8,9]", gson.toJson(target)); in testTopLevelArrayOfIntsSerialization()
69 assertEquals("[]", gson.toJson(target)); in testEmptyArraySerialization()
86 String json = gson.toJson(array); in testNullsInArraySerialization()
102 String json = gson.toJson(array); in testSingleNullInArraySerialization()
115 String json = gson.toJson(array); in testNullsInArrayWithSerializeNullPropertySetSerialization()
121 assertEquals("[\"Hello\",\"World\"]", gson.toJson(target)); in testArrayOfStringsSerialization()
133 String output = gson.toJson(s); in testSingleStringArraySerialization()
165 String json = gson.toJson(arrayOfCollection, typeToSerialize); in testArrayOfCollectionSerialization()
181 String json = gson.toJson(objs); in testArrayOfPrimitivesAsObjectsSerialization()
200 String classWithObjectsJson = gson.toJson(classWithObjects); in testObjectArrayWithNonPrimitivesSerialization()
[all …]
DDefaultTypeAdaptersTest.java90 gson.toJson(String.class); in testClassSerialization()
96 assertEquals("\"java.lang.String\"", gson.toJson(String.class)); in testClassSerialization()
113 assertEquals("\"http://google.com/\"", gson.toJson(url)); in testUrlSerialization()
128 assertEquals("{}", gson.toJson(target)); in testUrlNullSerialization()
144 assertEquals("\"http://google.com/\"", gson.toJson(uri)); in testUriSerialization()
190 assertEquals("null", gson.toJson(null, c)); in testNullSerializationAndDeserialization()
197 assertEquals('"' + uuidValue + '"', gson.toJson(uuid)); in testUuidSerialization()
209 assertEquals("\"en\"", gson.toJson(target)); in testLocaleSerializationWithLanguage()
220 assertEquals("\"fr_CA\"", gson.toJson(target)); in testLocaleSerializationWithLanguageCountry()
231 String json = gson.toJson(target); in testLocaleSerializationWithLanguageCountryVariant()
[all …]
DObjectTest.java97 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testBagOfPrimitivesSerialization()
109 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testBagOfPrimitiveWrappersSerialization()
121 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testClassWithTransientFieldsSerialization()
138 assertEquals("{}", gson.toJson(new ClassWithNoFields())); in testClassWithNoFieldsSerialization()
151 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testNestedSerialization()
162 assertEquals("null", gson.toJson(null)); in testNullSerialization()
186 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testNullFieldsSerialization()
198 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testArrayOfObjectsSerialization()
209 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testArrayOfArraysSerialization()
222 String classWithObjectsJson = gson.toJson(classWithObjects); in testArrayOfObjectsAsFields()
[all …]
DMapTest.java66 String json = gson.toJson(map, typeOfMap); in testMapSerialization()
83 String json = gson.toJson(map); in testObjectMapSerialization()
91 String json = gson.toJson(map, typeOfMap); in testMapSerializationEmpty()
105 String json = gson.toJson(map, typeOfMap); in testMapSerializationWithNullValue()
123 String json = gson.toJson(map, typeOfMap); in testMapSerializationWithNullValueButSerializeNulls()
132 String json = gson.toJson(map, typeOfMap); in testMapSerializationWithNullKey()
154 String json = gson.toJson(map, typeOfMap); in testMapSerializationWithIntegerKeys()
217 String json = gson.toJson(map); in testConcurrentMap()
227 String json = gson.toJson(map); in testConcurrentHashMap()
237 String json = gson.toJson(map); in testConcurrentNavigableMap()
[all …]
DStringTest.java24 assertEquals('"' + value + '"', gson.toJson(value)); in testStringValueSerialization()
35 String jsonRepresentation = gson.toJson(valueWithQuotes); in testSingleQuoteInStringSerialization()
41 String json = gson.toJson(value); in testEscapedCtrlNInStringSerialization()
53 String json = gson.toJson(value); in testEscapedCtrlRInStringSerialization()
65 String json = gson.toJson(value); in testEscapedBackslashInStringSerialization()
82 String jsonRepresentation = gson.toJson(valueWithQuotes); in testEscapingQuotesInStringSerialization()
96 assertEquals("[\"abc\"]", gson.toJson(target)); in testStringValueAsSingleElementArraySerialization()
97 assertEquals("[\"abc\"]", gson.toJson(target, String[].class)); in testStringValueAsSingleElementArraySerialization()
112 String json = gson.toJson(value); in testAssignmentCharSerialization()
131 String json = gson.toJson(value); in testJavascriptKeywordsInStringSerialization()
DRawSerializationTest.java43 String json = gson.toJson(ints); in testCollectionOfPrimitives()
49 String json = gson.toJson(foos); in testCollectionOfObjects()
57 String json = gson.toJson(bar); in testParameterizedObject()
60 json = gson.toJson(bar, new TypeToken<Bar<Foo>>(){}.getType()); in testParameterizedObject()
68 String json = gson.toJson(bar); in testTwoLevelParameterizedObject()
71 json = gson.toJson(bar, new TypeToken<Bar<Bar<Foo>>>(){}.getType()); in testTwoLevelParameterizedObject()
79 String json = gson.toJson(bar); in testThreeLevelParameterizedObject()
82 json = gson.toJson(bar, new TypeToken<Bar<Bar<Bar<Foo>>>>(){}.getType()); in testThreeLevelParameterizedObject()
DNullObjectAndFieldTest.java53 String actual = gson.toJson(null); in testTopLevelNullObjectSerialization()
56 actual = gson.toJson(null, String.class); in testTopLevelNullObjectSerialization()
69 String actual = gson.toJson(target); in testExplicitSerializationOfNulls()
83 String json = gson.toJson(target); in testExplicitSerializationOfNullArrayMembers()
93 String json = gson.toJson(target); in testNullWrappedPrimitiveMemberSerialization()
110 String json = gson.toJson(target); in testExplicitSerializationOfNullCollectionMembers()
117 String json = gson.toJson(target); in testExplicitSerializationOfNullStringMembers()
125 String actual = gson.toJson(target); in testCustomSerializationOfNulls()
133 String result = gson.toJson(new ClassWithMembers()); in testPrintPrintingObjectWithNulls()
137 result = gson.toJson(new ClassWithMembers()); in testPrintPrintingObjectWithNulls()
[all …]
DPrettyPrintingTest.java58 String json = gson.toJson(listOfB, typeOfSrc); in testPrettyPrintList()
64 String json = gson.toJson(target); in testPrettyPrintArrayOfObjects()
70 String json = gson.toJson(ints); in testPrettyPrintArrayOfPrimitives()
77 String json = gson.toJson(ints); in testPrettyPrintArrayOfPrimitiveArrays()
85 String json = gson.toJson(list); in testPrettyPrintListOfPrimitiveArrays()
94 String json = gson.toJson(map); in testMap()
102 String json = gson.toJson(obj); in testEmptyMapField()
114 String json = gson.toJson(ints); in testMultipleArrays()
DJava17RecordTest.java58 assertEquals("{\"name\":\"v1\",\"name1\":\"v2\"}", gson.toJson(target)); in testFirstNameIsChosenForSerialization()
105 assertEquals("{\"i-custom\":1}", gson.toJson(new LocalRecord(1))); in testFieldNamingStrategy()
172 assertEquals("{\"s\":\"accessor-value\"}", gson.toJson(new LocalRecord(null))); in testAccessorIsCalled()
188 gson.toJson(new LocalRecord("a")); in testThrowingAccessor()
202 assertEquals("{}", gson.toJson(new EmptyRecord())); in testEmptyRecord()
215 assertEquals("null", adapter.toJson(null)); in testRecordNull()
279 assertEquals("{}", gson.toJson(new RecordWithStaticField())); in testStaticFieldSerialization()
286 String json = gson.toJson(new RecordWithStaticField()); in testStaticFieldSerialization()
330 String json = gson.toJson(new RecordWithExpose(1, 2)); in testExposeAnnotation()
350 assertEquals("{\"b\":2}", gson.toJson(new LocalRecord(1, 2, 3.0))); in testFieldExclusionStrategy()
[all …]
DVersioningTest.java50 String json = gson.toJson(target); in testVersionedUntilSerialization()
54 json = gson.toJson(target); in testVersionedUntilSerialization()
58 json = gson.toJson(target); in testVersionedUntilSerialization()
82 String json1 = gson.toJson(new Version1()); in testVersionedClassesSerialization()
83 String json2 = gson.toJson(new Version1_1()); in testVersionedClassesSerialization()
103 assertEquals("null", gson.toJson(new Version1_2())); in testIgnoreLaterVersionClassSerialization()
120 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testVersionedGsonWithUnversionedClassesSerialization()
140 String json = gson.toJson(target); in testVersionedGsonMixingSinceAndUntilSerialization()
144 json = gson.toJson(target); in testVersionedGsonMixingSinceAndUntilSerialization()
148 json = gson.toJson(target); in testVersionedGsonMixingSinceAndUntilSerialization()
[all …]
DCollectionTest.java63 String json = gson.toJson(target, targetType); in testTopLevelCollectionOfIntegersSerialization()
97 String json = gson.toJson(list, linkedListType); in testLinkedListSerialization()
115 String json = gson.toJson(queue, queueType); in testQueueSerialization()
133 String json = gson.toJson(queue); in testPriorityQueue()
147 String json = gson.toJson(target); in testVector()
155 String json = gson.toJson(target); in testStack()
169 String json = gson.toJson(list, typeOfList); in testNullsInListSerialization()
190 assertEquals("[\"Hello\",\"World\"]", gson.toJson(target)); in testCollectionOfObjectSerialization()
193 assertEquals("[\"Hello\",\"World\"]", gson.toJson(target, type)); in testCollectionOfObjectSerialization()
201 assertEquals("[\"Hello\",null,\"World\"]", gson.toJson(target)); in testCollectionOfObjectWithNullSerialization()
[all …]
DNamingPolicyTest.java49 + target.someConstantStringInstanceField + "\"}", gson.toJson(target)); in testGsonWithNonDefaultFieldNamingPolicySerialization()
63 + target.someConstantStringInstanceField + "\"}", gson.toJson(target)); in testGsonWithLowerCaseDashPolicySerialization()
70 + target.someConstantStringInstanceField + "\"}", gson.toJson(target)); in testGsonWithLowerCaseDotPolicySerialization()
92 + target.someConstantStringInstanceField + "\"}", gson.toJson(target)); in testGsonWithLowerCaseUnderscorePolicySerialization()
106 String actual = gson.toJson(expected); in testGsonWithSerializedNameFieldNamingPolicySerialization()
122 gson.toJson(target); in testGsonDuplicateNameUsingSerializedNameFieldNamingPolicySerialization()
133 + target.someConstantStringInstanceField + "\"}", gson.toJson(target)); in testGsonWithUpperCamelCaseSpacesPolicySerialiation()
149 + target.someConstantStringInstanceField + "\"}", gson.toJson(target)); in testGsonWithUpperCaseUnderscorePolicySerialization()
163 String actual = gson.toJson(target); in testDeprecatedNamingStrategy()
169 String json = gson.toJson(new ClassWithComplexFieldName(10)); in testComplexFieldNameStrategy()
[all …]
DEnumTest.java58 String result = gson.toJson(MyEnum.VALUE1); in testTopLevelEnumSerialization()
73 String actualJson = gson.toJson(target); in testCollectionOfEnumsSerialization()
75 actualJson = gson.toJson(target, type); in testCollectionOfEnumsSerialization()
89 assertEquals(target.getExpectedJson(), gson.toJson(target)); in testClassWithEnumFieldSerialization()
116 assertEquals("\"ROCK\"", gson.toJson(Roshambo.ROCK)); in testEnumSubclass()
117 assertEquals("[\"ROCK\",\"PAPER\",\"SCISSORS\"]", gson.toJson(EnumSet.allOf(Roshambo.class))); in testEnumSubclass()
128 assertEquals("\"123ROCK\"", gson.toJson(Roshambo.ROCK)); in testEnumSubclassWithRegisteredTypeAdapter()
129 …assertEquals("[\"123ROCK\",\"123PAPER\",\"123SCISSORS\"]", gson.toJson(EnumSet.allOf(Roshambo.clas… in testEnumSubclassWithRegisteredTypeAdapter()
140 String json = gson.toJson(list); in testEnumSubclassAsParameterizedType()
151 assertEquals("\"boy\"", gson.toJson(Gender.MALE, Gender.class)); in testEnumCaseMapping()
[all …]
DEscapingTest.java43 String jsonRepresentation = gson.toJson(valueWithQuotes); in testEscapingQuotesInStringArray()
58 gson.toJson(strings)); in testEscapeAllHtmlCharacters()
63 String jsonRepresentation = gson.toJson(objWithPrimitives); in testEscapingObjectFields()
77 String escapedJsonForm = escapeHtmlGson.toJson(target); in testGsonAcceptsEscapedAndNonEscapedJsonDeserialization()
78 String nonEscapedJsonForm = noEscapeHtmlGson.toJson(target); in testGsonAcceptsEscapedAndNonEscapedJsonDeserialization()
87 String json = gson.toJson(gson.toJson(expected)); in testGsonDoubleDeserialization()
DCustomTypeAdaptersTest.java67 assertEquals("{\"bag\":5,\"value\":25}", gson.toJson(target)); in testCustomSerializers()
90 String jsonFromCustomSerializer = gson.toJson(newFooObject); in disable_testCustomSerializersOfSelf()
91 String jsonFromGson = basicGson.toJson(newFooObject); in disable_testCustomSerializersOfSelf()
100 String json = basicGson.toJson(expectedFoo); in disable_testCustomDeserializersOfSelf()
116 assertEquals("{\"bag\":6,\"value\":10}", gson.toJson(target)); in testCustomNestedSerializers()
143 String json = gson.toJson(b); in testCustomTypeAdapterDoesNotAppliesToSubClasses()
146 json = gson.toJson(b); in testCustomTypeAdapterDoesNotAppliesToSubClasses()
160 String json = gson.toJson(b); in testCustomTypeAdapterAppliesToSubClassesSerializedAsBaseClass()
163 json = gson.toJson(b, Base.class); in testCustomTypeAdapterAppliesToSubClassesSerializedAsBaseClass()
217 assertEquals("1", gson.toJson(true, boolean.class)); in testCustomSerializerInvokedForPrimitives()
[all …]
DFieldNamingTest.java38 gson.toJson(new TestNames()).replace('\"', '\'')); in testIdentity()
46 gson.toJson(new TestNames()).replace('\"', '\'')); in testUpperCamelCase()
54 gson.toJson(new TestNames()).replace('\"', '\'')); in testUpperCamelCaseWithSpaces()
62 gson.toJson(new TestNames()).replace('\"', '\'')); in testUpperCaseWithUnderscores()
70 gson.toJson(new TestNames()).replace('\"', '\'')); in testLowerCaseWithUnderscores()
78 gson.toJson(new TestNames()).replace('\"', '\'')); in testLowerCaseWithDashes()
DReflectionAccessFilterTest.java51 gson.toJson(new File("a")); in testBlockInaccessibleJava()
74 String json = gson.toJson(point); in testBlockInaccessibleJava()
85 gson.toJson(new ClassExtendingJdkClass()); in testBlockInaccessibleJavaExtendingJdkClass()
105 gson.toJson(Thread.currentThread()); in testBlockAllJava()
123 gson.toJson(new ClassExtendingJdkClass()); in testBlockAllJavaExtendingJdkClass()
153 gson.toJson(new ClassWithStaticField()); in testBlockInaccessibleStaticField()
196 gson.toJson(new SuperTestClass()); in testDelegation()
208 String json = gson.toJson(new SubTestClass()); in testDelegation()
212 json = gson.toJson(new OtherClass()); in testDelegation()
235 gson.toJson(new ExtendingClassWithPrivateField()); in testAllowForSupertype()
[all …]
DJavaUtilConcurrentAtomicTest.java46 String json = gson.toJson(target); in testAtomicBoolean()
53 String json = gson.toJson(target); in testAtomicInteger()
60 String json = gson.toJson(target); in testAtomicLong()
70 String json = gson.toJson(target); in testAtomicLongWithStringSerializationPolicy()
80 String json = gson.toJson(target); in testAtomicIntegerArray()
90 String json = gson.toJson(target); in testAtomicLongArray()
103 String json = gson.toJson(target); in testAtomicLongArrayWithStringSerializationPolicy()
/external/flatbuffers/kotlin/benchmark/src/jvmMain/kotlin/com/google/flatbuffers/kotlin/benchmark/
DJsonBenchmark.kt21 import com.google.flatbuffers.kotlin.toJson
86 …pTwitterFlexBuffers(hole: Blackhole? = null) = hole?.consume(readFlexBuffers(twitterData).toJson())
88 …fun roundTripTwitterMoshi(hole: Blackhole?) = hole?.consume(moshiAdapter.toJson(readMoshi(twitterD…
90 fun roundTripTwitterGson(hole: Blackhole?) = hole?.consume(gson.toJson(readGson(twitterData)))
96 fun readCITMMoshi(hole: Blackhole?) = hole?.consume(moshiAdapter.toJson(readMoshi(citmData)))
98 fun readCITMGson(hole: Blackhole?) = hole?.consume(gson.toJson(readGson(citmData)))
101 …undTripCITMFlexBuffers(hole: Blackhole? = null) = hole?.consume(readFlexBuffers(citmData).toJson())
103 fun roundTripCITMMoshi(hole: Blackhole?) = hole?.consume(moshiAdapter.toJson(readMoshi(citmData)))
105 fun roundTripCITMGson(hole: Blackhole?) = hole?.consume(gson.toJson(readGson(citmData)))
108 fun writeCITMFlexBuffers(hole: Blackhole? = null) = hole?.consume(fbCitmRef.toJson())
[all …]
/external/gson/gson/src/test/java/com/google/gson/
DMixedStreamTest.java57 gson.toJson(BLUE_MUSTANG, Car.class, jsonWriter); in testWriteMixedStreamed()
58 gson.toJson(BLACK_BMW, Car.class, jsonWriter); in testWriteMixedStreamed()
59 gson.toJson(RED_MIATA, Car.class, jsonWriter); in testWriteMixedStreamed()
98 gson.toJson(BLUE_MUSTANG, Car.class, jsonWriter); in testWriteDoesNotMutateState()
104 gson.toJson(BLUE_MUSTANG, Car.class, jsonWriter); in testWriteDoesNotMutateState()
137 gson.toJson(BLUE_MUSTANG, Car.class, jsonWriter); in testWriteInvalidState()
150 gson.toJson(BLUE_MUSTANG, Car.class, jsonWriter); in testWriteClosed()
159 gson.toJson(new JsonPrimitive("hello"), (JsonWriter) null); in testWriteNulls()
165 gson.toJson(null, new JsonWriter(stringWriter)); in testWriteNulls()
188 new Gson().toJson(contents, type, new JsonWriter(writer)); in testWriteHtmlSafe()
[all …]
DLongSerializationPolicyTest.java43 assertEquals("[1]", gson.toJson(new long[] { 1L }, long[].class)); in testDefaultLongSerializationIntegration()
44 assertEquals("[1]", gson.toJson(new Long[] { 1L }, Long[].class)); in testDefaultLongSerializationIntegration()
54 assertEquals("null", gson.toJson(null, Long.class)); in testDefaultLongSerializationNull()
71 assertEquals("[\"1\"]", gson.toJson(new long[] { 1L }, long[].class)); in testStringLongSerializationIntegration()
72 assertEquals("[\"1\"]", gson.toJson(new Long[] { 1L }, Long[].class)); in testStringLongSerializationIntegration()
82 assertEquals("null", gson.toJson(null, Long.class)); in testStringLongSerializationNull()
DOverrideCoreTypeAdaptersTest.java52 assertEquals("true", gson.toJson(true, boolean.class)); in testOverrideWrapperBooleanAdapter()
53 assertEquals("1", gson.toJson(true, Boolean.class)); in testOverrideWrapperBooleanAdapter()
63 assertEquals("1", gson.toJson(true, boolean.class)); in testOverridePrimitiveBooleanAdapter()
64 assertEquals("true", gson.toJson(true, Boolean.class)); in testOverridePrimitiveBooleanAdapter()
67 assertEquals("0", gson.toJson(false, boolean.class)); in testOverridePrimitiveBooleanAdapter()
74 assertEquals("\"HELLO\"", gson.toJson("Hello", String.class)); in testOverrideStringAdapter()
/external/sl4a/Common/src/com/googlecode/android_scripting/jsonrpc/
DJsonRpcHandler.java55 return Sl4aErrors.JSON_RPC_REQUEST_NOT_JSON.toJson(JSONObject.NULL); in getResponse()
98 return Sl4aErrors.SESSION_INVALID.toJson(id, mSessionId); in getResponse()
102 return Sl4aErrors.JSON_RPC_UNKNOWN_RPC_METHOD.toJson(id, method); in getResponse()
109 return Sl4aErrors.JSON_RPC_FACADE_EXCEPTION_OCCURRED.toJson(id, t); in getResponse()
119 return Sl4aErrors.JSON_RPC_RESULT_NOT_JSON_VALID.toJson(id, e); in getResponse()
124 return Sl4aErrors.JSON_RPC_FAILED_TO_BUILD_RESULT.toJson(id, t); in getResponse()
146 return Sl4aErrors.JSON_RPC_MISSING_ID.toJson(id); in getValidationErrors()
151 return Sl4aErrors.JSON_RPC_MISSING_METHOD.toJson(id); in getValidationErrors()
153 return Sl4aErrors.JSON_RPC_METHOD_NOT_STRING.toJson(id); in getValidationErrors()
156 return Sl4aErrors.JSON_RPC_PARAMS_NOT_AN_ARRAY.toJson(id); in getValidationErrors()

123456