score:0
Accepted answer
By having a look at the documentation, it's visible that JsObject
companion extends (Seq[(String, JsValue)]) ⇒ JsObject
, so rather than calling Json.obj
(with extra conversion):
import play.api.libs.json._
def foo(fields: List[(String, JsValue)]): JsObject = JsObject(fields)
score:0
I don't know that specific library, but this should break the list into a set of separate arguments:
Json.obj(listOfFields:_*)
Source: stackoverflow.com
Related Query
- How to build a json object given a list of fields (key -> value) in Scala
- How to "reads" into a Scala Case Class given a Json object with key names that start with a capital letter
- Converting a JSON object to a value list of a particular key in scala (play)
- How do I use scala and scalatest to see if a list contains an object with a field matching a specific value
- Scala how to get the key of Map where value as List
- Play2 and Scala (Jerkson) - List of JsObjects - how to convert to a Json object
- Scala how to get object property value given name of property in string?
- How to remove key value from json var using scala
- How do I take a list of keys that contains the value of the inputted key in the table in Scala
- how to convert map to a list of collection, where map key and value are the fields of that collection?
- How to remove key value from map when keys are store in list in scala
- How to generate a list with xml element as key and xml as value in scala
- How to read Json file in scala, so that all fields will be accessible as key value pairs as in python dictionary
- how to remove key value from map in scala
- How to convert casbah mongodb list to json in scala / play
- How to split a string given a list of positions in Scala
- How to turn a list of objects into a map of two fields in Scala
- How to add a json object in to a json array using scala play?
- Convert scala list to Json object
- Play: How to remove the fields without value from JSON and create a new JSON with them
- How to select a object field for map value in Scala using groupby
- How to sum values and group them by a key value in Scala's List of Map?
- How to traverse JSON object fields using JsPath?
- How to parse json list or array in scala for play framework 2.2
- How to check if a value is a Scala singleton object without a static type?
- How to specify only particular fields using read.schema in JSON : SPARK Scala
- How to get the closest value from map by given key in scala?
- How to convert nested JSON to map object in scala
- How can a reduce a key value pair to key and list of values?
- How to extend a Scala list to enable slicing not by explicit position but by given predicate/condition
More Query from same tag
- How to convert formatted String to Tuple in Scala?
- Using Flink to get Counts Within a Keyed Window
- How to change the background of a ScrollPane (JavaFX/ScalaFX)?
- Updating the collection by timeout with constant availability
- Scala: how to use a Java callback API
- Cant get akka to run accross 2 different machines - Cannot assign requested address
- IntelliJ "Cannot infer Scala class path..." but Gradle testCompile is correct?
- How to reduce multiple joins in spark
- Invoking print() with list.foreach in Scala is printing Nil
- Scala REPL does not work on Ubuntu
- Class re-appears in a class loader after using embedded interpreter
- Concise way of mapping null result of Option
- Scala web services
- Update deeply nested case class with Options
- how to parse specific portion of text file using two delimiters or strings in SCALA
- How to use reflection in Scala. I am trying to use getDeclaredMethod()
- Difference between type inference of method and class type parameters in pattern matching
- What goes into making a Proxy Server?
- Small Example of Jackson Scala Module?
- Abstract fields in traits (Scala) - construction order
- Not able to Explode and select in the same expression in spark scala
- Scala- zip with futures
- Can't add elements to Play session
- Adding params to Apache Spark's abstract Evaluator class
- Gradle: Setting up Scala project with Apache Spark in Eclipse
- How to pass co-variant varargs through apply() to a function that takes co-variant varargs of the same type
- Scala - How can we create class instance of same class?
- Inferring Type of NonEmptyList(String, List[Nothing])?
- scala try/catch not catching some exceptions
- how to get the mock TransportClient in ElasticSearch