Json
object Json
Provides JSON utilities.
import little.json.*
import little.json.Implicits.given
import scala.language.implicitConversions
// Create JSON object
val user = Json.obj("id" -> 1000, "name" -> "jza")
// Create JSON array
val info = Json.arr(user, "/home/jza", 8L * 1024 * 1024 * 1024)
// Parse JSON text
val root = Json.parse("""{ "id": 0, "name": "root" }""")
case class User(id: Int, name: String)
given userToJson: JsonOutput[User] with
def apply(u: User) = Json.obj("id" -> u.id, "name" -> u.name)
// Convert value to JSON object
val nobody = Json.toJson(User(65534, "nobody"))
class Object
trait Matchable
class Any
Value members
Concrete methods
Converts value to JSON value.
Converts value to JSON value.
- Value Params
- convert
output converter
- value
value
Creates "pretty" print of JSON using 2-space indent.
Creates "pretty" print of JSON using 2-space indent.