Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3345578
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:12:08+00:00 2026-05-18T01:12:08+00:00

I’m working on a simple web application with Scala. The plan is to obtain

  • 0

I’m working on a simple web application with Scala. The plan is to obtain JSON data from an external API, and insert it into a template (unfortunately, obtaining the data in XML is not an option).

I’ve tried working with Twitter’s scala-json library, but I can’t get it to compile properly (the code on github fails to update in sbt, saying standard-project 7.10 is not available and I haven’t worked that out yet).

lift-json looks impressive, but appears to be a lot more elaborate than I need right now.

Trying to import a library I’ve worked with in Java, jsonic, results in various arcane errors. This is too bad because I rather like how straightforward jsonic is.

I’ve made a bit of progress with the built in scala.util.parsing.json.JSON, but actually I can’t tell how to access the elements. I’m somewhat new to Scala, as you may have noted. How do you access the properties of JSONObjects?

scala.util.parsing.json.JSON has a lot of information, but is there a straightforward tutorial on how to use this anywhere?

I’m really only interested in deserializing JSON at the moment, to Ints, Strings, Maps and Lists. I don’t have a need to serialize objects or make the deserialized objects fit into a class at the moment.

Can anyone point me to ways to work with one of the aforementioned libraries, or help me get set up with a Java lib that will do what I want?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:12:09+00:00Added an answer on May 18, 2026 at 1:12 am

    Lift JSON provides several different styles of deserializing JSON. Each have their pros and cons.

    val json = JsonParser.parse(""" { "foo": { "bar": 10 }} """)
    

    LINQ style query comprehension:

    scala> for { JField("bar", JInt(x)) <- json } yield x 
    
    res0: List[BigInt] = List(10)
    

    More examples:
    http://github.com/lift/lift/blob/master/framework/lift-base/lift-json/src/test/scala/net/liftweb/json/QueryExamples.scala

    Extract values with case classes

    implicit val formats = net.liftweb.json.DefaultFormats 
    case class Foo(foo: Bar) 
    case class Bar(bar: Int) 
    json.extract[Foo] 
    

    More examples: https://github.com/lift/lift/blob/master/framework/lift-base/lift-json/src/test/scala/net/liftweb/json/ExtractionExamples.scala

    XPath style

    scala> val JInt(x) = json \ "foo" \ "bar"
    
    x: BigInt = 10
    

    Non-type safe values

    scala> json.values
    
    res0: Map((foo,Map(bar -> 10)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from
I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.