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.

Ability to serialize/deserialize unstructured data

See original GitHub issue

Describe the problem you’d like to solve

Sometimes I need to be able to break the glass and serialize/deserialize YAML without having well-structured POJOs/KOJOs.

Describe the solution you’d like

I’d like a canonical “vanilla” representation of YAML. It does not have to implement all YAML features (e.g., SnakeYAML chokes on tags in its vanilla codec implementation, and I’d be fine with that behavior). It could be a codec for YamlNode or Any or a new class created for this purpose.

This would bring it in line with other languages’ YAML implementations such as Python’s and Ruby’s.

Describe alternatives you’ve considered

A combination of SnakeYAML and Moshi.

Additional context

My context is also multi-document YAML streams from Kubernetes, just like #54 's case.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sjshuckcommented, Jul 11, 2022

I’m happy with @kitterion 's solution. Thanks for keeping this open despite me not finding time to work on it.

1reaction
sjshuckcommented, Jan 20, 2022

Great. It’s not pressing for me so I don’t know exactly when I can get to it, but I’d be happy to try to work on it if you want to keep this ticket open for a bit.

On Thu, Jan 20, 2022, 3:54 AM Charles Korn @.***> wrote:

Right, makes sense. Would you want to be able to go in the other direction as well? (eg. convert a YamlNode instance to a YAML string)

If you’re interested in submitting a PR, adding a parseToYamlNode method should be very straightforward - decodeFromReader already has access to the YamlNode https://github.com/charleskorn/kaml/blob/675f930eb9395d567cb0ff2ae1f37692eca381eb/src/jvmMain/kotlin/com/charleskorn/kaml/Yaml.kt#L53, so adding an alternative implementation that just stops there and returns the YamlNode should be very straightforward.

— Reply to this email directly, view it on GitHub https://github.com/charleskorn/kaml/issues/231#issuecomment-1017248078, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADX57ZIY4VHL2NFXYATHULDUW7EUFANCNFSM5MFUSXRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deserialization of untrusted data - OWASP Foundation
An attempt to serialize and then deserialize a class containing transient fields will result in NULLs where the non-transient data should be. This...
Read more >
Big Data Patterns | Mechanisms | Serialization Engine
A serialization engine provides the ability to serialize and deserialize data in a Big Data platform. In Big Data platforms, serialization is required...
Read more >
Serialization and Deserialization of JSON Data - C# Corner
We use the DataContractJsonSerializer class to serialize a type instance to a JSON string and deserialize the JSON string to a type instance....
Read more >
What is serialization and how does it work? - Hazelcast
Serialization is the process of converting a data object into a series of bytes that saves the state of the object in an...
Read more >
Data Serialization - Devopedia
Data serialization is the process of converting data objects present in complex data structures into a byte stream for storage, transfer and distribution ......
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