home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Lift Framework example source code file (JsonParserSpec.scala)

This example Lift Framework source code file (JsonParserSpec.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Lift Framework tags/keywords

buy, buy, each, feature, feature, game, innovation, innovation, parse, since, this, you, you, your

The Lift Framework JsonParserSpec.scala source code

/*
 * Copyright 2008-2011 WorldWide Conferencing, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.liftweb
package util

import org.specs.Specification

import common._


/**
 * Systems under specification for JsonParser.
 */
object JsonParserSpec extends Specification("JsonParser Specification") {

  "The JSON Parser" should {
    "parse very long strings without causing a stack overflow" in {
      val longJson = """{"command":"test","params":{"participants":"","subject":"You have been invited to play the Innovation Game: Buy a Feature","reply-to":"no-reply@innovationgames.com","body":"Dear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\nDear %name%,\r\n\r\nYou have been invited to play the Innovation Game(r) Buy a Feature to help us better understand what you're looking for in future products and services.\r\n\r\nTo play the game, click on the link below. This link will open a web site that will present you with a list of features. Each feature costs a certain amount of money. You will be given some money to spend on the features that you want to purchase. Since you probably won't have enough money to purchase everything you want, we encourage you to collaborate with other players to purchase features that you can't afford.\r\n\r\nHere are the details of the game.\r\n\r\nDate: %date%\r\n\r\nTime: %time%\r\n\r\nClick on this link to get see all of the features that are in this game: %featurelink%\r\n\r\nClick on this link to play the game: %playlink%\r\n\r\nHere are some additional tips for playing the game:\r\n\r\n* Your should enable pop-ups and cookies for the games.\r\n\r\nSincerely,\r\n\r\n%sendername%\r\n"}}"""

      val parsed = JSONParser.parse(longJson)
      parsed.isDefined must be(true)

      // "reply-to"
      (parsed.asA[Map[String, Any]] match {
        case Full(m) =>
        (m.get("command"), Box(m.get("params")).asA[Map[String, String]]) match {
          case (Some(c: String), Full(m2)) =>
          (c, m2("participants"), m2("reply-to"))

          case _ => ("", "", "")
        }

        case _ => ("", "", "")
      }) must be_== ("test", "", "no-reply@innovationgames.com")
    }

    "multiple double quotes must parse" in {
      val longJson =
      """{'name': 'two " double " quotes', 'canvas': {'backgroundImage': '/images/tree4.jpg', 'layers': [{'id': 'LYR5485429073', 'name': 'l1', 'regions': [{'id': 'RGN4297201744', 'name': 'New Region', 'geoData': {'x': [545, 477, 149, 149, 149]

, 'y': [90, 484, 137, 136, 136]

, 'z': 0}}]

}]

}, 'publicGame': false, 'is_started': false, 'is_stopped': false, 'description': 'desc', 'items': [{'id': 'ITEM691196221323', 'name': 'leaf', 'itemNum': 1, 'desc': '', 'where': {'geoData': {'x': 276, 'y': 86}, 'residesIn': []

}, 'type': {'name': 'Leaf', 'id': 'LeafType', 'imageFile': '/images/leaf.gif'}, 'comments': []

, 'readOnly': 'false', 'locked': 'false', 'relationships': []

}]

, 'items_remaining': [{'item_type_id': 'LeafType', 'count': 3}, {'item_type_id': 'GreenAppleType', 'count': 6}, {'item_type_id': 'RedSquareType', 'count': 8}]

, 'players': []

, 'player_presence': []

, 'chats': []

, 'actions': []

}"""


      val parsed = JSONParser.parse(longJson)
      parsed.isDefined must be(true)
    }

    "Parse long arrays" in {

      val longArray = "[" + (1 to 100000).map(i => '"'+i.toString+'"').mkString(", ") + "]"

      val p2 = JSONParser.parse(longArray)
      p2.isDefined must be(true).eventually
    }

    "Parse doubles" in {
      val p2 = JSONParser.parse("51.348484")
      p2.isDefined must be(true)
      p2.open_! must_== 51.348484
    }

    "Parse negative doubles" in {
      val p2 = JSONParser.parse("-51.348484")
      p2.isDefined must be(true)
      p2.open_! must_== -51.348484
    }

    "Parse negative longs" in {
      val p2 = JSONParser.parse("-517272833222")
      p2.isDefined must be(true)
      p2.open_! must_== -517272833222L
    }

    "complex JSON objects #2" in {
      val p2 = JSONParser.parse(
    """{"command":"setPoint","params":{"mf":51.3256123,"$a":-0.6379592,"x":-0.6379592,"y":51.3256123}}""")
      p2.isDefined must be(true)
      val params = p2.open_!.asInstanceOf[Map[String, Map[String, Any]]].apply("params")
      params("mf") must_== 51.3256123D
      params("$a") must_== -0.6379592D
      params("y") must_== 51.3256123D
      params("x") must_== -0.6379592D
    }

    "-0" in {
      val p2 = JSONParser.parse(
    """-0""")
      p2.isDefined must be(true)

    }

    "-0.5033" in {
      val p2 = JSONParser.parse(
    """-0.5033""")
      p2.isDefined must be(true)
      p2.open_! must_== -0.5033

    }

    "complex JSON objects" in {
      val p2 = JSONParser.parse(
    """{"command":"setPoint","params":{"mf":
51.3256123,"$a":-0.6379592,"x":-0.6379592,"y":51.3256123}}""")
      p2.isDefined must be(true)
      
    }
  }
}

Other Lift Framework examples (source code examples)

Here is a short list of links related to this Lift Framework JsonParserSpec.scala source code file:



my book on functional programming

 

new blog posts

 

Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.