I am trying to generated a json string using data ...
# javascript
n
I am trying to generated a json string using data generated by my data class in kotlin js.
Copy code
data class Test(var name: String = "", var age: Int = 0)

val output = JSON.stringify(Test("Nico", 25))
Output i get:
Copy code
{name: "Nico", age: 25}
The output i expected:
Copy code
{
  "name": "Nico",
  "age": 25
}
Aren't the keys supposed to be in double quotes as above compared to the first output?
✔️ 1
t
Not reproduced 😞 https://pl.kotl.in/o-ssiAe5v
👍 1
n
Thanks, i guess it is the version of Kotlin i am using. Let me update my project from 1.3.72 to 1.4.0.
After updating kotlin version to 1.4.0 it now works.
❤️ 1
😉 1