Scala Library
|
|
scala/util/parsing/json/JSON.scala
]
object
JSON
extends
Parserval myConversionFunc = {input : String => BigDecimal(input)} // Global override JSON.globalNumberParser = myConversionFunc // Per-thread override JSON.perThreadNumberParser = myConversionFunc
Values and Variables inherited from Parser | |
lexical, defaultNumberParser, numberParser |
Values and Variables inherited from Parsers | |
lastNoSuccess |
Method Summary | |
def
|
globalNumberParser : Function1 |
def
|
globalNumberParser_=
(f : Function1) : Unit
The global (VM) default function for converting a string to a numeric value.
|
def
|
parse
(input : java.lang.String) : Option[List[Any]]
Parse the given JSON string and return a list of elements. If the
string is a JSON object it will be a list of pairs. If it's a JSON
array it will be be a list of individual elements.
|
def
|
parseFull
(input : java.lang.String) : Option[Any]
Parse the given JSON string and return either a
List[Any]
if the JSON string specifies an Array , or a
Map[String,Any] if the JSON string specifies an object. |
def
|
perThreadNumberParser : Function1 |
def
|
perThreadNumberParser_=
(f : Function1) : Unit
Defines the function used to convert a numeric string literal into a numeric format on a per-thread
basis. Use globalNumberParser for a global override
|
def
|
resolveType
(input : List[Any]) : Any
A utility method to resolve a parsed JSON list into objects or
arrays. See the parse method for details.
|
Methods inherited from Parser | |
root, jsonObj, jsonArray, objEntry, value, stringVal, number |
Methods inherited from ImplicitConversions | |
flatten2, flatten3, flatten4, flatten5, headOptionTailToFunList |
Methods inherited from StdTokenParsers | |
keyword, numericLit, stringLit, ident |
Methods inherited from Parsers | |
Parser, OnceParser, commit, elem, elem, accept, accept, accept, acceptIf, acceptMatch, acceptSeq, failure, err, success, log, rep, repsep, rep1, rep1, repN, rep1sep, chainl1, chainl1, chainr1, opt, not, positioned, phrase, mkList |
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Method Details |
def
parse(input : java.lang.String) : Option[List[Any]]
input -
the given JSON string.
def
parseFull(input : java.lang.String) : Option[Any]
List[Any]
if the JSON string specifies an Array
, or a
Map[String,Any]
if the JSON string specifies an object.input -
the given JSON string.
def
globalNumberParser : Function1
def
perThreadNumberParser : Function1
Scala Library
|
|