All Downloads are FREE. Search and download functionalities are using the official Maven repository.

core.json.kt Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
package kotlin.js

@native public class Json() {
    public fun get(propertyName: String): Any? = noImpl
    public fun set(propertyName: String, value: Any?): Unit = noImpl
}

public fun json(vararg pairs: Pair): Json {
    val res: dynamic = js("({})")
    for((name, value) in pairs) {
        res[name] = value
    }
    return res
}

@library("jsonAddProperties")
public fun Json.add(other: Json): Json = noImpl

@native
public interface JsonClass {
    public fun stringify(o: Any): String
    public fun stringify(o: Any, replacer: (key: String, value: Any?)->Any?): String
    public fun stringify(o: Any, replacer: (key: String, value: Any?)->Any?, space: Int): String
    public fun stringify(o: Any, replacer: (key: String, value: Any?)->Any?, space: String): String
    public fun stringify(o: Any, replacer: Array): String
    public fun stringify(o: Any, replacer: Array, space: Int): String
    public fun stringify(o: Any, replacer: Array, space: String): String

    public fun parse(text: String): T
    public fun parse(text: String, reviver: ((key: String, value: Any?)->Any?)): T
}

@native
public val JSON: JsonClass = noImpl




© 2015 - 2024 Weber Informatics LLC | Privacy Policy