I need to write a function that recieve JsValue, and do those steps:
- check if its of type Array
- if its NOT Array, return the value inside a list
- if it IS Array, check if its Array of an object or simple typle (string, boolean etc)
- if its Array of simple type return this Array and print "this is an array with simple types"
- if its Array of objects return this Array and print "this is an array with objects"
so something like this:
def myFunc(json: JsValue) = {
if (json.isInstanceOf[JsArray]) {
// check if list of objects or simple type
// how do i check if its a list of objects or simple type??
} else {
JsArray(json)
}
}
thanks!