RosettaCodeData/Task/JSON/Gosu/json-6.gosu

29 lines
845 B
Plaintext

structure Person {
static function fromJson( jsonText: String ): Person {
return gw.lang.reflect.json.Json.fromJson( jsonText ) as Person
}
static function fromJsonUrl( url: String ): Person {
return new java.net.URL( url ).JsonContent
}
static function fromJsonUrl( url: java.net.URL ): Person {
return url.JsonContent
}
static function fromJsonFile( file: java.io.File ) : Person {
return fromJsonUrl( file.toURI().toURL() )
}
property get Address(): Address
property get Hobby(): List<Hobby>
property get Age(): Integer
property get Name(): String
structure Address {
property get Number(): Integer
property get State(): String
property get Street(): String
property get City(): String
}
structure Hobby {
property get Category(): String
property get Name(): String
}
}