Non-blocking way to build a struct from JsonObject (in Kotlin serialization)
See original GitHub issueHello, I am looking to see if there is a non-blocking way to build a Struct from the serialization JsonObject. I have the following code:
val jsonObject = Json.decodeFromString<JsonObject>("{}")
val structBuilder = Struct.newBuilder()
JsonFormat.parser().merge(jsonObject.toString(), structBuilder)
val struct = structBuilder.build()
but the merge call is a blocking one:
Just wondering if there is any solution besides moving the proto back to a string. Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
JSON features - GitHub
This is the fifth chapter of the Kotlin Serialization Guide. In this chapter, we'll walk through features of JSON serialization available in the...
Read more >Deserializing a json object property to a String using kotlinx ...
First create a transformer as follows: object JsonAsStringSerializer: JsonTransformingSerializer<String>(tSerializer = String.serializer()) ...
Read more >Package kotlinx. serialization. json
To create an instance of builder, use buildJsonArray build function. ... Class representing JSON object, consisting of name-value pairs, where value is ...
Read more >Create JSON manually with kotlinx.serialization - tonisives
Create JSON manually with kotlinx.serialization ... Kotlin serialization is a great library for serialisation in Kotlin. It is mainly geared ...
Read more >Kotlin serialization — Getting started | by Gurpreet Singh
2. Convert Kotlin object to JSON ... To deserialize an object (i.e. to convert it to JSON), stringify method can be used. Unlike...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jamesward done! https://github.com/grpc/grpc-kotlin/discussions
Maybe an admin on this repo (@bshaffer perhaps) can enable discussions? https://docs.github.com/en/discussions/quickstart