You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-1Lines changed: 36 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -307,14 +307,49 @@ val params: CurrentTimeRetrieveParams = CurrentTimeRetrieveParams.builder()
307
307
308
308
These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.
309
309
310
-
To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](onebusaway-sdk-kotlin-core/src/main/kotlin/org/onebusaway/core/JsonValue.kt) object to its setter:
310
+
To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](onebusaway-sdk-kotlin-core/src/main/kotlin/org/onebusaway/core/Values.kt) object to its setter:
val params:CurrentTimeRetrieveParams=CurrentTimeRetrieveParams.builder().build()
316
316
```
317
317
318
+
The most straightforward way to create a [`JsonValue`](onebusaway-sdk-kotlin-core/src/main/kotlin/org/onebusaway/core/Values.kt) is using its `from(...)` method:
319
+
320
+
```kotlin
321
+
importorg.onebusaway.core.JsonValue
322
+
323
+
// Create primitive JSON values
324
+
val nullValue:JsonValue=JsonValue.from(null)
325
+
val booleanValue:JsonValue=JsonValue.from(true)
326
+
val numberValue:JsonValue=JsonValue.from(42)
327
+
val stringValue:JsonValue=JsonValue.from("Hello World!")
328
+
329
+
// Create a JSON array value equivalent to `["Hello", "World"]`
330
+
val arrayValue:JsonValue=JsonValue.from(listOf(
331
+
"Hello", "World"
332
+
))
333
+
334
+
// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`
335
+
val objectValue:JsonValue=JsonValue.from(mapOf(
336
+
"a" to 1, "b" to 2
337
+
))
338
+
339
+
// Create an arbitrarily nested JSON equivalent to:
340
+
// {
341
+
// "a": [1, 2],
342
+
// "b": [3, 4]
343
+
// }
344
+
val complexValue:JsonValue=JsonValue.from(mapOf(
345
+
"a" to listOf(
346
+
1, 2
347
+
), "b" to listOf(
348
+
3, 4
349
+
)
350
+
))
351
+
```
352
+
318
353
### Response properties
319
354
320
355
To access undocumented response properties, call the `_additionalProperties()` method:
0 commit comments