Questions tagged [lift-json]

the lift-json parsing and formatting utilities for JSON

A JSON abstract syntax tree (AST) providing the following features:

  • Fast JSON parser
  • LINQ style queries
  • Case classes can be used to extract values from parsed JSON
  • Diff & merge
  • DSL to produce valid JSON
  • XPath like expressions and HOFs to manipulate JSON
  • Pretty and compact printing
  • XML conversions
  • Serialization
  • Low level pull parser API

Github: https://github.com/lift/lift/tree/master/framework/lift-base/lift-json/

130 questions
0
votes
2 answers

Support for Scala Enumeration by net.liftweb.json

I am using the liftweb JSON converter and got it working, by including the dependency in build.sbt like this: "net.liftweb" %% "lift-json" % "2.6.2" This all works before I added Enumerations. I can see here that Enumerations are supported, and…
Mahdi
  • 1,778
  • 1
  • 21
  • 35
0
votes
1 answer

Lift JSON: How to convert convert list of tuples to JsonAST?

The following code produces a List[JsonAst.JObject]: val json = recommendations.map { r => ("cardId" -> r._1) ~ ("count" -> r._2) } This one doesn't. It produces List[(String, Int)]: val json = recommendations.map { r => (r._1.toString ->…
Wonko
  • 176
  • 1
  • 9
0
votes
1 answer

lift json :net.liftweb.json.MappingException: unknown error

I have a class named Inbox which contains an Int and a List of Messages,Messages is another class so the problem is I want to store Inbox class in MongoDB for that i have to serialize it so i am using lift json .but it throws exception on…
swaheed
  • 3,671
  • 10
  • 42
  • 103
0
votes
1 answer

Lift JSON JValue Extract issue

import net.liftweb.json._ import net.liftweb.json.JsonAST._ import net.liftweb.json.Extraction._ import net.liftweb.json.Printer._ implicit val formats = net.liftweb.json.DefaultFormats val jV =…
user2780187
  • 677
  • 7
  • 16
0
votes
1 answer

Deserialise JSON to polymorphic types based on a type field

I am using lift-json 2.6 and Scala 2.11. I want to deserialise a JSON string representing a Map of 'sensors' to case classes (I don't care about serialisation back to JSON at all): case class TemperatureSensor( name: String, sensorType: String,…
caprica
  • 3,902
  • 4
  • 19
  • 39
0
votes
0 answers

Java 7 to Java 8 breaks our Lift JSON parser 2.6-RC1

I have a weird Scala runtime error running Lift JSON parser 2.6-RC1 and Java8. The code for the error is at https://github.com/listatree/lift-json-java8 The stacktrace error is at:…
Carlos Saltos
  • 1,385
  • 15
  • 15
0
votes
2 answers

Issue parsing JSON with Lift JSON

I am trying to parse JSON using the Lift JSON library. I have imported the library using SBT by adding the following statement to my build.sbt file: libraryDependencies +="net.liftweb" % "lift-json" % "2.0" I start SBT and run the Scala interpreter…
nidkil
  • 1,295
  • 1
  • 17
  • 28
0
votes
1 answer

Having problems parsing JSON object - JField(xyz,JDouble(90.21)) and accessing the value "xyz"

I have parsed a response from an HTTP API using the parse() function from the Lift library val resultObj = parse(response) val dps = resultObj \\ "dps" println("dps are "+dps) I have something like this now…
GothamGirl
  • 299
  • 1
  • 2
  • 15
0
votes
2 answers

Using Lift-Json with Case Classes

I can't seem to write proper case classes for this particular Json payload. I believe it has something to do with the first index in the array, which doesn't have a key string. Any ideas on how to remedy this? For reference, I am using Scala 2.10.4,…
0
votes
1 answer

extract mail object from json string

I am have sxtracted json resonse from Yahoo mail webservice. After that i parsed using play json library. Now i am not not able to iterate over it and construct list of mail objects with sender name, subject, ccList etc. Mail object i am trying to…
Rajeev
  • 4,762
  • 8
  • 41
  • 63
0
votes
2 answers

lift-json serialisation of case objects

I'd like to define a class class for JSON serialisation like so: case class Foo(id: String, variety: Variety) sealed trait Variety case object Bar extends Variety { override def toString = "1" } case object Baz extends Variety { override def…
Josh Glover
  • 25,142
  • 27
  • 92
  • 129
0
votes
1 answer

What is a better way to transform in Scala lift JValue?

I am given js1 as a string. I want to nest "a", "b", "c" under "abc". I feel like this can be done a few lines of code. What is a better way to do this below? val js1 = """ { "name" : "test", "a" : true, "b" : true, "c" : true, …
john terran
  • 61
  • 1
  • 7
0
votes
1 answer

What is an efficient way to doing this using scala lift?

I want to merge data from one json to another json utilizing scala lift. In the example below, in "jsonGroups", I want to count all the groups "tom" and "dan" are part of and insert the grpCount to "jsonNames". The println(newJson) needs to equal…
john terran
  • 61
  • 1
  • 7
0
votes
1 answer

Flatten extranous fields when extracting using LiftJson or Json4s

I want to extract using LiftJson or Json4s the following Json (not quite but something similar) to the following case classes. { "data": [ { "id": "1234", "message": "Test", "comments": { "data": [ { "id":…
LabOctoCat
  • 611
  • 7
  • 17
0
votes
2 answers

Test JSON with spec2 in Scala

I'm trying to test a Json with Specs2 but I always get a parse error. Maybe because I use a JObect? val j: JObject = "hello" -> "world" j must */("hello") this is the error: Search_fields Could not…
YoBre
  • 2,520
  • 5
  • 27
  • 37
1 2 3
8
9