question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non-blocking way to build a struct from JsonObject (in Kotlin serialization)

See original GitHub issue

Hello, 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:

Screen Shot 2021-04-11 at 12 45 50 AM

Just wondering if there is any solution besides moving the proto back to a string. Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jameswardcommented, Apr 13, 2021

Maybe an admin on this repo (@bshaffer perhaps) can enable discussions? https://docs.github.com/en/discussions/quickstart

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found