score:0
with this query:
originaldf.withcolumn("plan",
from_json($"strjson", schema))
.select($"plan.payload.detail.data.object.items.data"
.getitem(0)
.getfield("plan")
.getfield("amount")).show()
i obtain the result:
+-------------------------------------------------------------------+
|plan.payload.detail.data.object.items.data as `data`[0].plan.amount|
+-------------------------------------------------------------------+
| 0|
+-------------------------------------------------------------------+
check this out
Source: stackoverflow.com
Related Query
- How to select a JSON field contained in an array
- How to turn json to case class when case class has only one field
- How to parse and extract information from json array using json4s
- How to iterate org.json4s.JsonAST.JValue which is an array of JSON objects to separately work on each object in Scala?
- How to use Spark SQL to parse the JSON array of objects
- How to add a json object in to a json array using scala play?
- how to read json with an optional field serialized by a missing field, in upickle
- How can I select a non-sequential subset elements from an array using Scala and Spark?
- How to select a object field for map value in Scala using groupby
- How to select a subset of fields from an array column in Spark?
- How to bind a array form field with Playframework scala
- How to write dataframe as json array to a file? (scala)
- How to query on data frame where 1 field of StringType has json value in Spark SQL
- How to flatten a js array on Play using JSON transformers?
- How to parse json list or array in scala for play framework 2.2
- How to serialize/deserialize dynamic field names using Play's json
- How to get array from a json formatted form in Scala?
- How to filter JSON array results based on condition?
- PlayFramework: how to transform each element of a JSON array
- How to parse an array of json in scala play framework?
- How to parse a json containing a field that always has a changed name in Scala?
- How do I throw an error when an unknown field is present whilst reading JSON with Scala Play?
- How to write a scala array into json file?
- How to match a top level array in json with specs2
- How do I deserialize a JSON array using the Play API
- How to let Spark parse a JSON-escaped String field as a JSON Object to infer the proper structure in DataFrames?
- Scala Spark How can I convert a column array[string] to a string with JSON array in it?
- Play json parse missing field as empty array
- How to count the number of elements (except one) in an array field in streaming dataset?
- How to decode missing json array as empty List with circe
More Query from same tag
- Does Scala work well on proprietary JVM's?
- How to get the row from a dataframe that has the maximum value in a specific column?
- Is there a good way to have granular control over error handling in `cats.effect.Resource`?
- Overriding arithmetic operators on Int via implicit conversions
- scala/Serializable NoClassDefFoundError (RMI w/ Scala)
- How to use UPDATE command in spark-sql & DataFrames
- Using OrderedRDD functions in spark
- how to flatten disjunction type
- How to pass elements of a list to concat function?
- Scala error when defining class
- AutoRefineV not picking up explicit inference from Map?
- How do I get the current script or class name in Scala?
- Call Solr asynchronous from Play Framework
- Correct way to approach splitting a trait
- Extending a generic type
- spark dataframe handle option some none
- Eventually didn't tolerate unsuccessful attempts before giving up
- Convert date time to unix_timestamp Scala
- In Scala, how to create a TypeTag from a type that is serializable?
- How to prevent percent decoding of URIs in Akka Http redirect requests?
- Use a saved model to transform another data without fitting again Spark
- How to truncate two uuid and generate new uuid in scala
- Designing a filter using scala - For loop unrolling
- Reading CSV using spark-csv package in spark-shell
- Where does set come from in "val Singleton4 : Set = set => set == 4"?
- play! 2.1.3 scala app/views/*.jade do not get included as part of play dist
- Does using option type remove need for if statements?
- Why can't Scala infer the type of _?
- Scala + Akka, pass byte arrays of images via messages?
- Mutable map with multiple values in Scala