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.

Computed property not serialize

See original GitHub issue

A data class with computed property:

data class Bean(val name: String) {
  val computed: String
    get() = "--$name"  
}

Use `kotlinx-serialization-runtime-0.20.0’:

val result = Json(Stable).stringify(Bean.serializer(), Bean(name = "rj"))

the result is {"name":"rj"} but I want it to be {"name":"rj","computed":"--rj"}. How?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:7
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
grangejcommented, May 10, 2020

I need this feature also.

Example use case: my image urls are computed and not stored in the database.

2reactions
Marek00Malikcommented, May 5, 2022

This is still open?

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Why are properties without a setter not serialized
I have a serializable class and one of the properties in my class generates a Guid in the getter. The property implements no...
Read more >
4 ways to make a property deserializable but not serializable ...
Approach 1: Use attributes JsonProperty together with JsonIgnore · We still use [JsonIgnore] attribute, adding it to the property which we do not...
Read more >
Serialize computed property Carbon instance - Laracasts
Hi, my model offers a computed property called "departureTime"; if a departure time is available, it will be returned as a Carbon instance....
Read more >
Should I expose a "computed" value as a property or a method?
not more than, let's say, ten times slower to compute than fetching from a field. ... Knerd makes a good point: properties can...
Read more >
Ember Models - Computed Property - General
Seems that computed properties are being phased out but not sure if there's ... If it's like a “front-end only” field or something...
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