Java Code Examples for javax.json.Json#createValue()
The following examples show how to use
javax.json.Json#createValue() .
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: JsonUtilsTests.java From smallrye-jwt with Apache License 2.0 | 5 votes |
@Test public void testWrapClaimValueString() { JsonValue expResult = Json.createValue("string"); JsonValue result = JsonUtils.wrapValue("string"); assertEquals(expResult, result); }
Example 2
Source File: JsonUtilsTests.java From smallrye-jwt with Apache License 2.0 | 5 votes |
@Test public void testWrapClaimValueNumber() { JsonValue expResult = Json.createValue(1); JsonValue result = JsonUtils.wrapValue(1); assertEquals(expResult, result); }
Example 3
Source File: JsonUtilsTests.java From smallrye-jwt with Apache License 2.0 | 5 votes |
@Test public void testWrapClaimValueNumberDecimal() { JsonValue expResult = Json.createValue(1.1d); JsonValue result = JsonUtils.wrapValue(1.1d); assertEquals(expResult, result); }
Example 4
Source File: JsonPointerCrud.java From tutorials with MIT License | 5 votes |
public JsonStructure update(String key, String newValue) { JsonPointer jsonPointer = Json.createPointer("/" + key); JsonString jsonNewValue = Json.createValue(newValue); jsonStructure = jsonPointer.replace(jsonStructure, jsonNewValue); return jsonStructure; }
Example 5
Source File: JsonMergePatchExample.java From Java-EE-8-Sampler with MIT License | 4 votes |
public JsonValue changeValue() { JsonValue source = Json.createValue("{\"colour\":\"blue\"}"); JsonValue patch = Json.createValue("{\"colour\":\"red\"}"); JsonMergePatch jsonMergePatch = Json.createMergePatch(patch); return jsonMergePatch.apply(source); }
Example 6
Source File: JsonMergePatchExample.java From Java-EE-8-Sampler with MIT License | 4 votes |
public JsonValue addValue() { JsonValue source = Json.createValue("{\"colour\":\"blue\"}"); JsonValue patch = Json.createValue("{\"blue\":\"light\"}"); JsonMergePatch jsonMergePatch = Json.createMergePatch(patch); return jsonMergePatch.apply(source); }
Example 7
Source File: JsonMergePatchExample.java From Java-EE-8-Sampler with MIT License | 4 votes |
public JsonValue deleteValue() { JsonValue source = Json.createValue("{\"colour\":\"blue\"}"); JsonValue patch = Json.createValue("{\"colour\":null}"); JsonMergePatch jsonMergePatch = Json.createMergePatch(patch); return jsonMergePatch.apply(source); }
Example 8
Source File: JsonMergeDiffExample.java From Java-EE-8-Sampler with MIT License | 4 votes |
public JsonMergePatch createMergePatch(){ JsonValue source = Json.createValue("{\"colour\":\"blue\"}"); JsonValue target = Json.createValue("{\"colour\":\"red\"}"); JsonMergePatch jsonMergePatch = Json.createMergeDiff(source, target); return jsonMergePatch; }
Example 9
Source File: FirstNameAdapter.java From Java-EE-8-Sampler with MIT License | 4 votes |
@Override public JsonValue adaptToJson(String firstName) { return Json.createValue(firstName.subSequence(0,1).toString()); }
Example 10
Source File: JsonpRuntime.java From jmespath-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public JsonValue createNumber(double n) { return Json.createValue(n); }
Example 11
Source File: JsonpRuntime.java From jmespath-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public JsonValue createNumber(long n) { return Json.createValue(n); }
Example 12
Source File: JsonPointerCrud.java From tutorials with MIT License | 3 votes |
public JsonStructure insert(String key, String value) { JsonPointer jsonPointer = Json.createPointer("/" + key); JsonString jsonValue = Json.createValue(value); jsonStructure = jsonPointer.add(jsonStructure, jsonValue); return jsonStructure; }