misc: change package to compat and make maven-local be able

This commit is contained in:
2025-05-08 17:32:17 +08:00
parent 82a02d879e
commit d9f0355f0c
84 changed files with 406 additions and 22941 deletions

View File

@@ -1,43 +0,0 @@
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '18 18 * * 1'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- run: "mvn clean compile -Dmaven.test.skip=true -Dmaven.site.skip=true -Dmaven.javadoc.skip=true"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@@ -1,228 +0,0 @@
# This workflow will build a Java project with Maven
# For more information see: https://docs.github.com/en/actions/learn-github-actions or https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Java CI with Maven
on:
push:
# branches: [ master ]
pull_request:
branches: [ master ]
jobs:
# old-school build and jar method. No tests run or compiled.
build-1_6:
name: Java 1.6
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: 1.6
- name: Compile Java 1.6
run: |
mkdir -p target/classes
javac -version
javac -source 1.6 -target 1.6 -d target/classes/ src/main/java/org/json/*.java
- name: Create java 1.6 JAR
run: |
jar cvf target/org.json.jar -C target/classes .
- name: Upload JAR 1.6
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Create java 1.6 JAR
path: target/*.jar
build-8:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
# build against supported Java LTS versions:
java: [ 8 ]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Compile Java ${{ matrix.java }}
run: mvn clean compile -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }} -D maven.test.skip=true -D maven.site.skip=true -D maven.javadoc.skip=true
- name: Run Tests ${{ matrix.java }}
run: |
mvn test -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
- name: Build Test Report ${{ matrix.java }}
if: ${{ always() }}
run: |
mvn surefire-report:report-only -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
mvn site -D generateReports=false -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
- name: Upload Test Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Test Results ${{ matrix.java }}
path: target/surefire-reports/
- name: Upload Test Report ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Test Report ${{ matrix.java }}
path: target/site/
- name: Package Jar ${{ matrix.java }}
run: mvn clean package -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }} -D maven.test.skip=true -D maven.site.skip=true
- name: Upload Package Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Package Jar ${{ matrix.java }}
path: target/*.jar
build-11:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
# build against supported Java LTS versions:
java: [ 11 ]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Compile Java ${{ matrix.java }}
run: mvn clean compile -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }} -D maven.test.skip=true -D maven.site.skip=true -D maven.javadoc.skip=true
- name: Run Tests ${{ matrix.java }}
run: |
mvn test -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
- name: Build Test Report ${{ matrix.java }}
if: ${{ always() }}
run: |
mvn surefire-report:report-only -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
mvn site -D generateReports=false -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
- name: Upload Test Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Test Results ${{ matrix.java }}
path: target/surefire-reports/
- name: Upload Test Report ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Test Report ${{ matrix.java }}
path: target/site/
- name: Package Jar ${{ matrix.java }}
run: mvn clean package -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }} -D maven.test.skip=true -D maven.site.skip=true
- name: Upload Package Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Package Jar ${{ matrix.java }}
path: target/*.jar
build-17:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
# build against supported Java LTS versions:
java: [ 17 ]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Compile Java ${{ matrix.java }}
run: mvn clean compile -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }} -D maven.test.skip=true -D maven.site.skip=true -D maven.javadoc.skip=true
- name: Run Tests ${{ matrix.java }}
run: |
mvn test -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
- name: Build Test Report ${{ matrix.java }}
if: ${{ always() }}
run: |
mvn surefire-report:report-only -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
mvn site -D generateReports=false -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
- name: Upload Test Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Test Results ${{ matrix.java }}
path: target/surefire-reports/
- name: Upload Test Report ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Test Report ${{ matrix.java }}
path: target/site/
- name: Package Jar ${{ matrix.java }}
run: mvn clean package -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }} -D maven.test.skip=true -D maven.site.skip=true
- name: Upload Package Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Package Jar ${{ matrix.java }}
path: target/*.jar
build-21:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
# build against supported Java LTS versions:
java: [ 21 ]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Compile Java ${{ matrix.java }}
run: mvn clean compile -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }} -D maven.test.skip=true -D maven.site.skip=true -D maven.javadoc.skip=true
- name: Run Tests ${{ matrix.java }}
run: |
mvn test -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
- name: Build Test Report ${{ matrix.java }}
if: ${{ always() }}
run: |
mvn surefire-report:report-only -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
mvn site -D generateReports=false -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }}
- name: Upload Test Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Test Results ${{ matrix.java }}
path: target/surefire-reports/
- name: Upload Test Report ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Test Report ${{ matrix.java }}
path: target/site/
- name: Package Jar ${{ matrix.java }}
run: mvn clean package -D maven.compiler.source=${{ matrix.java }} -D maven.compiler.target=${{ matrix.java }} -D maven.test.skip=true -D maven.site.skip=true
- name: Upload Package Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: Package Jar ${{ matrix.java }}
path: target/*.jar

View File

@@ -2,15 +2,8 @@
* This file was generated by the Gradle 'init' task.
*/
apply plugin: 'java'
apply plugin: 'eclipse'
// apply plugin: 'jacoco'
apply plugin: 'maven-publish'
//plugins {
// id 'java'
//id 'maven-publish'
// }
repositories {
mavenLocal()
mavenCentral()
@@ -25,12 +18,8 @@ dependencies {
testImplementation 'org.mockito:mockito-core:4.2.0'
}
subprojects {
tasks.withType(Javadoc).all { enabled = false }
}
group = 'org.json'
version = 'v20250107-SNAPSHOT'
group = 'org.json.compat'
version = 'v20250107-local'
description = 'JSON in Java'
sourceCompatibility = '1.8'
@@ -45,6 +34,7 @@ java {
publishing {
publications {
maven(MavenPublication) {
artifactId = 'json'
from(components.java)
}
}
@@ -66,7 +56,7 @@ task modifyStrictMode {
doLast {
println "Modifying JSONParserConfiguration.java to enable strictMode..."
def filePath = project.file('src/main/java/org/json/JSONParserConfiguration.java')
def filePath = project.file('src/main/java/org/json/compat/JSONParserConfiguration.java')
if (!filePath.exists()) {
throw new GradleException("Could not find file: ${filePath.absolutePath}")
@@ -92,7 +82,7 @@ task restoreStrictMode {
doLast {
println "Restoring original JSONParserConfiguration.java..."
def filePath = project.file('src/main/java/org/json/JSONParserConfiguration.java')
def filePath = project.file('src/main/java/org/json/compat/JSONParserConfiguration.java')
def backupFile = new File(filePath.absolutePath + '.bak')
if (backupFile.exists()) {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

254
pom.xml
View File

@@ -1,254 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20250107</version>
<packaging>bundle</packaging>
<name>JSON in Java</name>
<description>
JSON is a light-weight, language independent, data interchange format.
See http://www.JSON.org/
The files in this package implement JSON encoders/decoders in Java.
It also includes the capability to convert between JSON and XML, HTTP
headers, Cookies, and CDL.
This is a reference implementation. There are a large number of JSON packages
in Java. Perhaps someday the Java community will standardize on one. Until
then, choose carefully.
</description>
<url>https://github.com/douglascrockford/JSON-java</url>
<scm>
<url>https://github.com/douglascrockford/JSON-java.git</url>
<connection>scm:git:git://github.com/douglascrockford/JSON-java.git</connection>
<developerConnection>scm:git:git@github.com:douglascrockford/JSON-java.git</developerConnection>
</scm>
<licenses>
<license>
<name>Public Domain</name>
<url>https://github.com/stleary/JSON-java/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Douglas Crockford</name>
<email>douglas@crockford.com</email>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.9</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>
org.json
</Export-Package>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>1.0.0.Final</version>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<jvmVersion>9</jvmVersion>
<module>
<moduleInfoSource>
module org.json {
exports org.json;
}
</moduleInfoSource>
</module>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>test-strict-mode</id>
<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<!-- Enable strict mode -->
<execution>
<id>enable-strict-mode</id>
<phase>process-sources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<file>src/main/java/org/json/JSONParserConfiguration.java</file>
<replacements>
<replacement>
<token>// this.strictMode = true;</token>
<value>this.strictMode = true;</value>
</replacement>
</replacements>
</configuration>
</execution>
<!-- Restore original code after tests -->
<execution>
<id>restore-original</id>
<phase>test</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<file>src/main/java/org/json/JSONParserConfiguration.java</file>
<replacements>
<replacement>
<token>this.strictMode = true;</token>
<value>// this.strictMode = true;</value>
</replacement>
</replacements>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.
@@ -100,15 +100,11 @@ public class CDL {
for (;;) {
String value = getValue(x,delimiter);
char c = x.next();
if (value != null) {
ja.put(value);
} else if (ja.length() == 0 && c != delimiter) {
if (value == null ||
(ja.length() == 0 && value.length() == 0 && c != delimiter)) {
return null;
} else {
// This line accounts for CSV ending with no newline
ja.put("");
}
ja.put(value);
for (;;) {
if (c == delimiter) {
break;
@@ -311,17 +307,6 @@ public class CDL {
if (ja.length() == 0) {
return null;
}
// The following block accounts for empty datasets (no keys or vals)
if (ja.length() == 1) {
JSONObject j = ja.getJSONObject(0);
if (j.length() == 1) {
String key = j.keys().next();
if ("".equals(key) && "".equals(j.get(key))) {
return null;
}
}
}
return ja;
}

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
import java.util.Locale;

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.
@@ -75,19 +75,20 @@ public class JSONArray implements Iterable<Object> {
}
/**
* Construct a JSONArray from a JSONTokener.
* Constructs a JSONArray from a JSONTokener.
* <p>
* This constructor reads the JSONTokener to parse a JSON array. It uses the default JSONParserConfiguration.
*
* @param x
* A JSONTokener
* @throws JSONException
* If there is a syntax error.
* @param x A JSONTokener
* @throws JSONException If there is a syntax error.
*/
public JSONArray(JSONTokener x) throws JSONException {
this(x, x.getJsonParserConfiguration());
this(x, new JSONParserConfiguration());
}
/**
* Constructs a JSONArray from a JSONTokener and a JSONParserConfiguration.
* JSONParserConfiguration contains strictMode turned off (false) by default.
*
* @param x A JSONTokener instance from which the JSONArray is constructed.
* @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser.
@@ -95,67 +96,83 @@ public class JSONArray implements Iterable<Object> {
*/
public JSONArray(JSONTokener x, JSONParserConfiguration jsonParserConfiguration) throws JSONException {
this();
char nextChar = x.nextClean();
boolean isInitial = x.getPrevious() == 0;
if (x.nextClean() != '[') {
// check first character, if not '[' throw JSONException
if (nextChar != '[') {
throw x.syntaxError("A JSONArray text must start with '['");
}
char nextChar = x.nextClean();
if (nextChar == 0) {
// array is unclosed. No ']' found, instead EOF
throw x.syntaxError("Expected a ',' or ']'");
}
if (nextChar != ']') {
x.back();
for (;;) {
if (x.nextClean() == ',') {
x.back();
this.myArrayList.add(JSONObject.NULL);
} else {
x.back();
this.myArrayList.add(x.nextValue());
parseTokener(x, jsonParserConfiguration); // runs recursively
}
private void parseTokener(JSONTokener x, JSONParserConfiguration jsonParserConfiguration) {
boolean strictMode = jsonParserConfiguration.isStrictMode();
char cursor = x.nextClean();
switch (cursor) {
case 0:
throwErrorIfEoF(x);
break;
case ',':
cursor = x.nextClean();
throwErrorIfEoF(x);
if(strictMode && cursor == ']'){
throw x.syntaxError(getInvalidCharErrorMsg(cursor));
}
switch (x.nextClean()) {
case 0:
// array is unclosed. No ']' found, instead EOF
throw x.syntaxError("Expected a ',' or ']'");
case ',':
nextChar = x.nextClean();
if (nextChar == 0) {
// array is unclosed. No ']' found, instead EOF
throw x.syntaxError("Expected a ',' or ']'");
}
if (nextChar == ']') {
// trailing commas are not allowed in strict mode
if (jsonParserConfiguration.isStrictMode()) {
throw x.syntaxError("Strict mode error: Expected another array element");
}
return;
}
if (nextChar == ',') {
// consecutive commas are not allowed in strict mode
if (jsonParserConfiguration.isStrictMode()) {
throw x.syntaxError("Strict mode error: Expected a valid array element");
}
return;
}
x.back();
if (cursor == ']') {
break;
case ']':
if (isInitial && jsonParserConfiguration.isStrictMode() &&
x.nextClean() != 0) {
throw x.syntaxError("Strict mode error: Unparsed characters found at end of input text");
}
return;
default:
throw x.syntaxError("Expected a ',' or ']'");
}
}
} else {
if (isInitial && jsonParserConfiguration.isStrictMode() && x.nextClean() != 0) {
throw x.syntaxError("Strict mode error: Unparsed characters found at end of input text");
}
x.back();
parseTokener(x, jsonParserConfiguration);
break;
case ']':
if (strictMode) {
cursor = x.nextClean();
boolean isEoF = x.end();
if (isEoF) {
break;
}
if (x.getArrayLevel() == 0) {
throw x.syntaxError(getInvalidCharErrorMsg(cursor));
}
x.back();
}
break;
default:
x.back();
boolean currentCharIsQuote = x.getPrevious() == '"';
boolean quoteIsNotNextToValidChar = x.getPreviousChar() != ',' && x.getPreviousChar() != '[';
if (strictMode && currentCharIsQuote && quoteIsNotNextToValidChar) {
throw x.syntaxError(getInvalidCharErrorMsg(cursor));
}
this.myArrayList.add(x.nextValue(jsonParserConfiguration));
parseTokener(x, jsonParserConfiguration);
}
}
/**
* Throws JSONException if JSONTokener has reached end of file, usually when array is unclosed. No ']' found,
* instead EoF.
*
* @param x the JSONTokener being evaluated.
* @throws JSONException if JSONTokener has reached end of file.
*/
private void throwErrorIfEoF(JSONTokener x) {
if (x.end()) {
throw x.syntaxError(String.format("Expected a ',' or ']' but instead found '%s'", x.getPrevious()));
}
}
@@ -170,22 +187,19 @@ public class JSONArray implements Iterable<Object> {
* If there is a syntax error.
*/
public JSONArray(String source) throws JSONException {
this(source, new JSONParserConfiguration());
this(new JSONTokener(source), new JSONParserConfiguration());
}
/**
* Construct a JSONArray from a source JSON text.
* Constructs a JSONArray from a source JSON text and a JSONParserConfiguration.
*
* @param source
* A string that begins with <code>[</code>&nbsp;<small>(left
* bracket)</small> and ends with <code>]</code>
* &nbsp;<small>(right bracket)</small>.
* @param jsonParserConfiguration the parser config object
* @throws JSONException
* If there is a syntax error.
* @param source A string that begins with <code>[</code>&nbsp;<small>(left bracket)</small> and
* ends with <code>]</code> &nbsp;<small>(right bracket)</small>.
* @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser.
* @throws JSONException If there is a syntax error.
*/
public JSONArray(String source, JSONParserConfiguration jsonParserConfiguration) throws JSONException {
this(new JSONTokener(source, jsonParserConfiguration), jsonParserConfiguration);
this(new JSONTokener(source), jsonParserConfiguration);
}
/**
@@ -414,7 +428,7 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the enum value associated with an index.
*
*
* @param <E>
* Enum Type
* @param clazz
@@ -602,7 +616,7 @@ public class JSONArray implements Iterable<Object> {
if (len == 0) {
return "";
}
StringBuilder sb = new StringBuilder(
JSONObject.valueToString(this.myArrayList.get(0)));
@@ -916,7 +930,7 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the enum value associated with a key.
*
*
* @param <E>
* Enum Type
* @param clazz
@@ -931,7 +945,7 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the enum value associated with a key.
*
*
* @param <E>
* Enum Type
* @param clazz
@@ -964,8 +978,8 @@ public class JSONArray implements Iterable<Object> {
}
/**
* Get the optional BigInteger value associated with an index. The
* defaultValue is returned if there is no value for the index, or if the
* Get the optional BigInteger value associated with an index. The
* defaultValue is returned if there is no value for the index, or if the
* value is not a number and cannot be converted to a number.
*
* @param index
@@ -980,8 +994,8 @@ public class JSONArray implements Iterable<Object> {
}
/**
* Get the optional BigDecimal value associated with an index. The
* defaultValue is returned if there is no value for the index, or if the
* Get the optional BigDecimal value associated with an index. The
* defaultValue is returned if there is no value for the index, or if the
* value is not a number and cannot be converted to a number. If the value
* is float or double, the {@link BigDecimal#BigDecimal(double)}
* constructor will be used. See notes on the constructor for conversion
@@ -1150,7 +1164,7 @@ public class JSONArray implements Iterable<Object> {
if (val instanceof Number){
return (Number) val;
}
if (val instanceof String) {
try {
return JSONObject.stringToNumber((String) val);
@@ -1227,7 +1241,7 @@ public class JSONArray implements Iterable<Object> {
public JSONArray put(double value) throws JSONException {
return this.put(Double.valueOf(value));
}
/**
* Append a float value. This increases the array's length by one.
*
@@ -1482,19 +1496,19 @@ public class JSONArray implements Iterable<Object> {
*
* @param collection
* A Collection.
* @return this.
* @return this.
*/
public JSONArray putAll(Collection<?> collection) {
this.addAll(collection, false);
return this;
}
/**
* Put an Iterable's elements in to the JSONArray.
*
* @param iter
* An Iterable.
* @return this.
* @return this.
*/
public JSONArray putAll(Iterable<?> iter) {
this.addAll(iter, false);
@@ -1506,7 +1520,7 @@ public class JSONArray implements Iterable<Object> {
*
* @param array
* A JSONArray.
* @return this.
* @return this.
*/
public JSONArray putAll(JSONArray array) {
// directly copy the elements from the source array to this one
@@ -1521,7 +1535,7 @@ public class JSONArray implements Iterable<Object> {
* @param array
* Array. If the parameter passed is null, or not an array or Iterable, an
* exception will be thrown.
* @return this.
* @return this.
*
* @throws JSONException
* If not an array, JSONArray, Iterable or if an value is non-finite number.
@@ -1532,9 +1546,9 @@ public class JSONArray implements Iterable<Object> {
this.addAll(array, false);
return this;
}
/**
* Creates a JSONPointer using an initialization string and tries to
* Creates a JSONPointer using an initialization string and tries to
* match it to an item within this JSONArray. For example, given a
* JSONArray initialized with this document:
* <pre>
@@ -1542,7 +1556,7 @@ public class JSONArray implements Iterable<Object> {
* {"b":"c"}
* ]
* </pre>
* and this JSONPointer string:
* and this JSONPointer string:
* <pre>
* "/0/b"
* </pre>
@@ -1555,9 +1569,9 @@ public class JSONArray implements Iterable<Object> {
public Object query(String jsonPointer) {
return query(new JSONPointer(jsonPointer));
}
/**
* Uses a user initialized JSONPointer and tries to
* Uses a user initialized JSONPointer and tries to
* match it to an item within this JSONArray. For example, given a
* JSONArray initialized with this document:
* <pre>
@@ -1565,7 +1579,7 @@ public class JSONArray implements Iterable<Object> {
* {"b":"c"}
* ]
* </pre>
* and this JSONPointer:
* and this JSONPointer:
* <pre>
* "/0/b"
* </pre>
@@ -1578,11 +1592,11 @@ public class JSONArray implements Iterable<Object> {
public Object query(JSONPointer jsonPointer) {
return jsonPointer.queryFrom(this);
}
/**
* Queries and returns a value from this object using {@code jsonPointer}, or
* returns null if the query fails due to a missing key.
*
*
* @param jsonPointer the string representation of the JSON pointer
* @return the queried value or {@code null}
* @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax
@@ -1590,11 +1604,11 @@ public class JSONArray implements Iterable<Object> {
public Object optQuery(String jsonPointer) {
return optQuery(new JSONPointer(jsonPointer));
}
/**
* Queries and returns a value from this object using {@code jsonPointer}, or
* returns null if the query fails due to a missing key.
*
*
* @param jsonPointer The JSON pointer
* @return the queried value or {@code null}
* @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax
@@ -1714,11 +1728,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Make a pretty-printed JSON text of this JSONArray.
*
*
* <p>If <pre> {@code indentFactor > 0}</pre> and the {@link JSONArray} has only
* one element, then the array will be output on a single line:
* <pre>{@code [1]}</pre>
*
*
* <p>If an array has 2 or more elements, then it will be output across
* multiple lines: <pre>{@code
* [
@@ -1730,7 +1744,7 @@ public class JSONArray implements Iterable<Object> {
* <p><b>
* Warning: This method assumes that the data structure is acyclical.
* </b>
*
*
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @return a printable, displayable, transmittable representation of the
@@ -1764,11 +1778,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Write the contents of the JSONArray as JSON text to a writer.
*
*
* <p>If <pre>{@code indentFactor > 0}</pre> and the {@link JSONArray} has only
* one element, then the array will be output on a single line:
* <pre>{@code [1]}</pre>
*
*
* <p>If an array has 2 or more elements, then it will be output across
* multiple lines: <pre>{@code
* [
@@ -1948,6 +1962,7 @@ public class JSONArray implements Iterable<Object> {
private void addAll(Object array, boolean wrap, int recursionDepth) {
addAll(array, wrap, recursionDepth, new JSONParserConfiguration());
}
/**
* Add an array's elements to the JSONArray.
*`
@@ -1986,7 +2001,7 @@ public class JSONArray implements Iterable<Object> {
// JSONArray
this.myArrayList.addAll(((JSONArray)array).myArrayList);
} else if (array instanceof Collection) {
this.addAll((Collection<?>)array, wrap, recursionDepth, jsonParserConfiguration);
this.addAll((Collection<?>)array, wrap, recursionDepth);
} else if (array instanceof Iterable) {
this.addAll((Iterable<?>)array, wrap);
} else {
@@ -1994,7 +2009,6 @@ public class JSONArray implements Iterable<Object> {
"JSONArray initial value should be a string or collection or array.");
}
}
/**
* Create a new JSONException in a common format for incorrect conversions.
* @param idx index of the item
@@ -2023,4 +2037,7 @@ public class JSONArray implements Iterable<Object> {
, cause);
}
private static String getInvalidCharErrorMsg(char cursor) {
return String.format("invalid character '%s' found after end of array", cursor);
}
}

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.
*/

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.
@@ -195,7 +195,7 @@ public class JSONObject {
* duplicated key.
*/
public JSONObject(JSONTokener x) throws JSONException {
this(x, x.getJsonParserConfiguration());
this(x, new JSONParserConfiguration());
}
/**
@@ -214,23 +214,18 @@ public class JSONObject {
char c;
String key;
boolean isInitial = x.getPrevious() == 0;
if (x.nextClean() != '{') {
throw x.syntaxError("A JSONObject text must begin with '{'");
}
for (;;) {
c = x.nextClean();
switch (c) {
case 0:
throw x.syntaxError("A JSONObject text must end with '}'");
case '}':
if (isInitial && jsonParserConfiguration.isStrictMode() && x.nextClean() != 0) {
throw x.syntaxError("Strict mode error: Unparsed characters found at end of input text");
}
return;
default:
key = x.nextSimpleValue(c).toString();
case 0:
throw x.syntaxError("A JSONObject text must end with '}'");
case '}':
return;
default:
key = x.nextSimpleValue(c, jsonParserConfiguration).toString();
}
// The key is followed by ':'.
@@ -249,7 +244,7 @@ public class JSONObject {
throw x.syntaxError("Duplicate key \"" + key + "\"");
}
Object value = x.nextValue();
Object value = x.nextValue(jsonParserConfiguration);
// Only add value if non-null
if (value != null) {
this.put(key, value);
@@ -260,16 +255,8 @@ public class JSONObject {
switch (x.nextClean()) {
case ';':
// In strict mode semicolon is not a valid separator
if (jsonParserConfiguration.isStrictMode()) {
throw x.syntaxError("Strict mode error: Invalid character ';' found");
}
case ',':
if (x.nextClean() == '}') {
// trailing commas are not allowed in strict mode
if (jsonParserConfiguration.isStrictMode()) {
throw x.syntaxError("Strict mode error: Expected another object element");
}
return;
}
if (x.end()) {
@@ -278,9 +265,6 @@ public class JSONObject {
x.back();
break;
case '}':
if (isInitial && jsonParserConfiguration.isStrictMode() && x.nextClean() != 0) {
throw x.syntaxError("Strict mode error: Unparsed characters found at end of input text");
}
return;
default:
throw x.syntaxError("Expected a ',' or '}'");
@@ -332,7 +316,7 @@ public class JSONObject {
throw new NullPointerException("Null key.");
}
final Object value = e.getValue();
if (value != null || jsonParserConfiguration.isUseNativeNulls()) {
if (value != null) {
testValidity(value);
this.map.put(String.valueOf(e.getKey()), wrap(value, recursionDepth + 1, jsonParserConfiguration));
}
@@ -466,7 +450,7 @@ public class JSONObject {
* duplicated key.
*/
public JSONObject(String source, JSONParserConfiguration jsonParserConfiguration) throws JSONException {
this(new JSONTokener(source, jsonParserConfiguration), jsonParserConfiguration);
this(new JSONTokener(source), jsonParserConfiguration);
}
/**

View File

@@ -1,18 +1,27 @@
package org.json;
package org.json.compat;
/**
* Configuration object for the JSON parser. The configuration is immutable.
*/
public class JSONParserConfiguration extends ParserConfiguration {
/** Original Configuration of the JSON Parser. */
public static final JSONParserConfiguration ORIGINAL = new JSONParserConfiguration();
/** Original configuration of the JSON Parser except that values are kept as strings. */
public static final JSONParserConfiguration KEEP_STRINGS = new JSONParserConfiguration().withKeepStrings(true);
/**
* Used to indicate whether to overwrite duplicate key or not.
*/
private boolean overwriteDuplicateKey;
/**
* Used to indicate whether to convert java null values to JSONObject.NULL or ignoring the entry when converting java maps.
* This flag, when set to true, instructs the parser to throw a JSONException if it encounters an invalid character
* immediately following the final ']' character in the input. This is useful for ensuring strict adherence to the
* JSON syntax, as any characters after the final closing bracket of a JSON array are considered invalid.
*/
private boolean useNativeNulls;
private boolean strictMode;
/**
* Configuration with the default values.
@@ -20,24 +29,13 @@ public class JSONParserConfiguration extends ParserConfiguration {
public JSONParserConfiguration() {
super();
this.overwriteDuplicateKey = false;
// DO NOT DELETE THE FOLLOWING LINE -- it is used for strictMode testing
// this.strictMode = true;
}
/**
* This flag, when set to true, instructs the parser to enforce strict mode when parsing JSON text.
* Garbage chars at the end of the doc, unquoted string, and single-quoted strings are all disallowed.
*/
private boolean strictMode;
@Override
protected JSONParserConfiguration clone() {
JSONParserConfiguration clone = new JSONParserConfiguration();
clone.overwriteDuplicateKey = overwriteDuplicateKey;
clone.strictMode = strictMode;
clone.maxNestingDepth = maxNestingDepth;
clone.keepStrings = keepStrings;
clone.useNativeNulls = useNativeNulls;
return clone;
}
@@ -73,33 +71,7 @@ public class JSONParserConfiguration extends ParserConfiguration {
return clone;
}
/**
* Controls the parser's behavior when meeting Java null values while converting maps.
* If set to true, the parser will put a JSONObject.NULL into the resulting JSONObject.
* Or the map entry will be ignored.
*
* @param useNativeNulls defines if the parser should convert null values in Java maps
* @return The existing configuration will not be modified. A new configuration is returned.
*/
public JSONParserConfiguration withUseNativeNulls(final boolean useNativeNulls) {
JSONParserConfiguration clone = this.clone();
clone.useNativeNulls = useNativeNulls;
return clone;
}
/**
* Sets the strict mode configuration for the JSON parser with default true value
* <p>
* When strict mode is enabled, the parser will throw a JSONException if it encounters an invalid character
* immediately following the final ']' character in the input. This is useful for ensuring strict adherence to the
* JSON syntax, as any characters after the final closing bracket of a JSON array are considered invalid.
* @return a new JSONParserConfiguration instance with the updated strict mode setting
*/
public JSONParserConfiguration withStrictMode() {
return withStrictMode(true);
}
/**
* Sets the strict mode configuration for the JSON parser.
@@ -127,24 +99,16 @@ public class JSONParserConfiguration extends ParserConfiguration {
public boolean isOverwriteDuplicateKey() {
return this.overwriteDuplicateKey;
}
/**
* The parser's behavior when meeting a null value in a java map, controls whether the parser should
* write a JSON entry with a null value (<code>isUseNativeNulls() == true</code>)
* or ignore that map entry (<code>isUseNativeNulls() == false</code>).
*
* @return The <code>useNativeNulls</code> configuration value.
*/
public boolean isUseNativeNulls() {
return this.useNativeNulls;
}
/**
* The parser throws an Exception when strict mode is true and tries to parse invalid JSON characters.
* Otherwise, the parser is more relaxed and might tolerate some invalid characters.
* Retrieves the current strict mode setting of the JSON parser.
* <p>
* Strict mode, when enabled, instructs the parser to throw a JSONException if it encounters an invalid character
* immediately following the final ']' character in the input. This ensures strict adherence to the JSON syntax, as
* any characters after the final closing bracket of a JSON array are considered invalid.
*
* @return the current strict mode setting.
* @return the current strict mode setting. True if strict mode is enabled, false otherwise.
*/
public boolean isStrictMode() {
return this.strictMode;

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
import static java.lang.String.format;

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,7 +1,9 @@
package org.json;
package org.json.compat;
import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
/*
Public Domain.
@@ -31,28 +33,16 @@ public class JSONTokener {
private boolean usePrevious;
/** the number of characters read in the previous line. */
private long characterPreviousLine;
private final List<Character> smallCharMemory;
private int arrayLevel = 0;
// access to this object is required for strict mode checking
private JSONParserConfiguration jsonParserConfiguration;
/**
* Construct a JSONTokener from a Reader. The caller must close the Reader.
*
* @param reader the source.
* @param reader A reader.
*/
public JSONTokener(Reader reader) {
this(reader, new JSONParserConfiguration());
}
/**
* Construct a JSONTokener from a Reader with a given JSONParserConfiguration. The caller must close the Reader.
*
* @param reader the source.
* @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser.
*
*/
public JSONTokener(Reader reader, JSONParserConfiguration jsonParserConfiguration) {
this.jsonParserConfiguration = jsonParserConfiguration;
this.reader = reader.markSupported()
? reader
: new BufferedReader(reader);
@@ -63,62 +53,28 @@ public class JSONTokener {
this.character = 1;
this.characterPreviousLine = 0;
this.line = 1;
this.smallCharMemory = new ArrayList<Character>(2);
}
/**
* Construct a JSONTokener from an InputStream. The caller must close the input stream.
* @param inputStream The source.
*/
public JSONTokener(InputStream inputStream) {
this(inputStream, new JSONParserConfiguration());
}
/**
* Construct a JSONTokener from an InputStream. The caller must close the input stream.
* @param inputStream The source.
* @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser.
*/
public JSONTokener(InputStream inputStream, JSONParserConfiguration jsonParserConfiguration) {
this(new InputStreamReader(inputStream, Charset.forName("UTF-8")), jsonParserConfiguration);
this(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
}
/**
* Construct a JSONTokener from a string.
*
* @param source A source string.
* @param s A source string.
*/
public JSONTokener(String source) {
this(new StringReader(source));
public JSONTokener(String s) {
this(new StringReader(s));
}
/**
* Construct a JSONTokener from an InputStream. The caller must close the input stream.
* @param source The source.
* @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser.
*/
public JSONTokener(String source, JSONParserConfiguration jsonParserConfiguration) {
this(new StringReader(source), jsonParserConfiguration);
}
/**
* Getter
* @return jsonParserConfiguration
*/
public JSONParserConfiguration getJsonParserConfiguration() {
return jsonParserConfiguration;
}
/**
* Setter
* @param jsonParserConfiguration new value for jsonParserConfiguration
*
* @deprecated method should not be used
*/
@Deprecated
public void setJsonParserConfiguration(JSONParserConfiguration jsonParserConfiguration) {
this.jsonParserConfiguration = jsonParserConfiguration;
}
/**
* Back up one character. This provides a sort of lookahead capability,
@@ -235,6 +191,46 @@ public class JSONTokener {
return this.previous;
}
private void insertCharacterInCharMemory(Character c) {
boolean foundSameCharRef = checkForEqualCharRefInMicroCharMemory(c);
if(foundSameCharRef){
return;
}
if(smallCharMemory.size() < 2){
smallCharMemory.add(c);
return;
}
smallCharMemory.set(0, smallCharMemory.get(1));
smallCharMemory.remove(1);
smallCharMemory.add(c);
}
private boolean checkForEqualCharRefInMicroCharMemory(Character c) {
boolean isNotEmpty = !smallCharMemory.isEmpty();
if (isNotEmpty) {
Character lastChar = smallCharMemory.get(smallCharMemory.size() - 1);
return c.compareTo(lastChar) == 0;
}
// list is empty so there's no equal characters
return false;
}
/**
* Retrieves the previous char from memory.
*
* @return previous char stored in memory.
*/
public char getPreviousChar() {
return smallCharMemory.get(0);
}
public int getArrayLevel(){
return this.arrayLevel;
}
/**
* Get the last character read from the input or '\0' if nothing has been read yet.
* @return the last character read from the input.
@@ -312,7 +308,6 @@ public class JSONTokener {
return new String(chars);
}
/**
* Get the next char in the string, skipping whitespace.
* @throws JSONException Thrown if there is an error reading the source string.
@@ -322,6 +317,7 @@ public class JSONTokener {
for (;;) {
char c = this.next();
if (c == 0 || c > ' ') {
insertCharacterInCharMemory(c);
return c;
}
}
@@ -329,15 +325,14 @@ public class JSONTokener {
/**
* Return the characters up to the next close quote character.
* Backslash processing is done. The formal JSON format does not
* allow strings in single quotes, but an implementation is allowed to
* accept them.
* Return the characters up to the next close quote character. Backslash processing is done. The formal JSON format
* does not allow strings in single quotes, but an implementation is allowed to accept them.
*
* @param quote The quoting character, either
* <code>"</code>&nbsp;<small>(double quote)</small> or
* <code>'</code>&nbsp;<small>(single quote)</small>.
* @return A String.
* @throws JSONException Unterminated string.
* @return A String.
* @throws JSONException Unterminated string or unbalanced quotes if strictMode == true.
*/
public String nextString(char quote) throws JSONException {
char c;
@@ -345,58 +340,59 @@ public class JSONTokener {
for (;;) {
c = this.next();
switch (c) {
case 0:
case '\n':
case '\r':
throw this.syntaxError("Unterminated string. " +
case 0:
case '\n':
case '\r':
throw this.syntaxError("Unterminated string. " +
"Character with int code " + (int) c + " is not allowed within a quoted string.");
case '\\':
c = this.next();
switch (c) {
case 'b':
sb.append('\b');
break;
case 't':
sb.append('\t');
break;
case 'n':
sb.append('\n');
break;
case 'f':
sb.append('\f');
break;
case 'r':
sb.append('\r');
break;
case 'u':
String next = this.next(4);
try {
sb.append((char)Integer.parseInt(next, 16));
} catch (NumberFormatException e) {
throw this.syntaxError("Illegal escape. " +
"\\u must be followed by a 4 digit hexadecimal number. \\" + next + " is not valid.", e);
case '\\':
c = this.next();
switch (c) {
case 'b':
sb.append('\b');
break;
case 't':
sb.append('\t');
break;
case 'n':
sb.append('\n');
break;
case 'f':
sb.append('\f');
break;
case 'r':
sb.append('\r');
break;
case 'u':
String next = this.next(4);
try {
sb.append((char) Integer.parseInt(next, 16));
} catch (NumberFormatException e) {
throw this.syntaxError("Illegal escape. " +
"\\u must be followed by a 4 digit hexadecimal number. \\" + next
+ " is not valid.",
e);
}
break;
case '"':
case '\'':
case '\\':
case '/':
sb.append(c);
break;
default:
throw this.syntaxError("Illegal escape. Escape sequence \\" + c + " is not valid.");
}
break;
case '"':
case '\'':
case '\\':
case '/':
sb.append(c);
break;
default:
throw this.syntaxError("Illegal escape. Escape sequence \\" + c + " is not valid.");
}
break;
default:
if (c == quote) {
return sb.toString();
}
sb.append(c);
if (c == quote) {
return sb.toString();
}
sb.append(c);
}
}
}
/**
* Get the text up but not including the specified character or the
* end of line, whichever comes first.
@@ -446,57 +442,113 @@ public class JSONTokener {
/**
* Get the next value. The value can be a Boolean, Double, Integer,
* JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
* @throws JSONException If syntax error.
* Get the next value. The value can be a Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the
* JSONObject.NULL object.
*
* @return An object.
* @throws JSONException If syntax error.
*/
public Object nextValue() throws JSONException {
char c = this.nextClean();
switch (c) {
case '{':
this.back();
try {
return new JSONObject(this, jsonParserConfiguration);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
case '[':
this.back();
try {
return new JSONArray(this, jsonParserConfiguration);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
}
return nextSimpleValue(c);
return nextValue(new JSONParserConfiguration());
}
Object nextSimpleValue(char c) {
String string;
// Strict mode only allows strings with explicit double quotes
if (jsonParserConfiguration != null &&
jsonParserConfiguration.isStrictMode() &&
c == '\'') {
throw this.syntaxError("Strict mode error: Single quoted strings are not allowed");
}
/**
* Get the next value. The value can be a Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the
* JSONObject.NULL object. The strictMode parameter controls the behavior of the method when parsing the value.
*
* @param jsonParserConfiguration which carries options such as strictMode, these methods will
* strictly adhere to the JSON syntax, throwing a JSONException for any deviations.
* @return An object.
* @throws JSONException If syntax error.
*/
public Object nextValue(JSONParserConfiguration jsonParserConfiguration) throws JSONException {
char c = this.nextClean();
switch (c) {
case '"':
case '\'':
case '{':
this.back();
try {
return new JSONObject(this, jsonParserConfiguration);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
case '[':
this.back();
try {
this.arrayLevel++;
return new JSONArray(this, jsonParserConfiguration);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
default:
return nextSimpleValue(c, jsonParserConfiguration);
}
}
/**
* This method is used to get a JSONObject from the JSONTokener. The strictMode parameter controls the behavior of
* the method when parsing the JSONObject.
*
* @param jsonParserConfiguration which carries options such as strictMode, these methods will
* strictly adhere to the JSON syntax, throwing a JSONException for any deviations.
* deviations.
* @return A JSONObject which is the next value in the JSONTokener.
* @throws JSONException If the JSONObject or JSONArray depth is too large to process.
*/
private JSONObject getJsonObject(JSONParserConfiguration jsonParserConfiguration) {
try {
return new JSONObject(this, jsonParserConfiguration);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
}
/**
* This method is used to get a JSONArray from the JSONTokener.
*
* @return A JSONArray which is the next value in the JSONTokener.
* @throws JSONException If the JSONArray depth is too large to process.
*/
private JSONArray getJsonArray() {
try {
return new JSONArray(this);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
}
/**
* Get the next simple value from the JSON input. Simple values include strings (wrapped in single or double
* quotes), numbers, booleans, and null. This method is called when the next character is not '{' or '['.
*
* @param c The starting character.
* @param jsonParserConfiguration The configuration object containing parsing options.
* @return The parsed simple value.
* @throws JSONException If there is a syntax error or the value does not adhere to the configuration rules.
*/
Object nextSimpleValue(char c, JSONParserConfiguration jsonParserConfiguration) {
boolean strictMode = jsonParserConfiguration.isStrictMode();
if (strictMode && c == '\'') {
throw this.syntaxError("Single quote wrap not allowed in strict mode");
}
if (c == '"' || c == '\'') {
return this.nextString(c);
}
/*
* Handle unquoted text. This could be the values true, false, or
* null, or it can be a number. An implementation (such as this one)
* is allowed to also accept non-standard forms.
*
* Accumulate characters until we reach the end of the text or a
* formatting character.
*/
return parsedUnquotedText(c, strictMode);
}
/**
* Parses unquoted text from the JSON input. This could be the values true, false, or null, or it can be a number.
* Non-standard forms are also accepted. Characters are accumulated until the end of the text or a formatting
* character is reached.
*
* @param c The starting character.
* @return The parsed object.
* @throws JSONException If the parsed string is empty.
*/
private Object parsedUnquotedText(char c, boolean strictMode) {
StringBuilder sb = new StringBuilder();
while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
sb.append(c);
@@ -506,20 +558,24 @@ public class JSONTokener {
this.back();
}
string = sb.toString().trim();
if ("".equals(string)) {
String string = sb.toString().trim();
if (string.isEmpty()) {
throw this.syntaxError("Missing value");
}
Object obj = JSONObject.stringToValue(string);
// Strict mode only allows strings with explicit double quotes
if (jsonParserConfiguration != null &&
jsonParserConfiguration.isStrictMode() &&
obj instanceof String) {
throw this.syntaxError(String.format("Strict mode error: Value '%s' is not surrounded by quotes", obj));
}
return obj;
Object stringToValue = JSONObject.stringToValue(string);
return strictMode ? getValidNumberBooleanOrNullFromObject(stringToValue) : stringToValue;
}
private Object getValidNumberBooleanOrNullFromObject(Object value) {
if (value instanceof Number || value instanceof Boolean || value.equals(JSONObject.NULL)) {
return value;
}
throw this.syntaxError(String.format("Value '%s' is not surrounded by quotes", value));
}
/**
* Skip characters until the next character is the requested character.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
import java.io.IOException;
import java.util.Collection;

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.
*/

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
import java.io.IOException;
import java.io.Writer;

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.
@@ -355,20 +355,10 @@ public class XML {
&& TYPE_ATTR.equals(string)) {
xmlXsiTypeConverter = config.getXsiTypeMap().get(token);
} else if (!nilAttributeFound) {
Object obj = stringToValue((String) token);
if (obj instanceof Boolean) {
jsonObject.accumulate(string,
config.isKeepBooleanAsString()
? ((String) token)
: obj);
} else if (obj instanceof Number) {
jsonObject.accumulate(string,
config.isKeepNumberAsString()
? ((String) token)
: obj);
} else {
jsonObject.accumulate(string, stringToValue((String) token));
}
jsonObject.accumulate(string,
config.isKeepStrings()
? ((String) token)
: stringToValue((String) token));
}
token = null;
} else {
@@ -417,20 +407,8 @@ public class XML {
jsonObject.accumulate(config.getcDataTagName(),
stringToValue(string, xmlXsiTypeConverter));
} else {
Object obj = stringToValue((String) token);
if (obj instanceof Boolean) {
jsonObject.accumulate(config.getcDataTagName(),
config.isKeepBooleanAsString()
? ((String) token)
: obj);
} else if (obj instanceof Number) {
jsonObject.accumulate(config.getcDataTagName(),
config.isKeepNumberAsString()
? ((String) token)
: obj);
} else {
jsonObject.accumulate(config.getcDataTagName(), stringToValue((String) token));
}
jsonObject.accumulate(config.getcDataTagName(),
config.isKeepStrings() ? string : stringToValue(string));
}
}
@@ -710,44 +688,6 @@ public class XML {
return toJSONObject(reader, XMLParserConfiguration.ORIGINAL);
}
/**
* Convert a well-formed (but not necessarily valid) XML into a
* JSONObject. Some information may be lost in this transformation because
* JSON is a data format and XML is a document format. XML uses elements,
* attributes, and content text, while JSON uses unordered collections of
* name/value pairs and arrays of values. JSON does not does not like to
* distinguish between elements and attributes. Sequences of similar
* elements are represented as JSONArrays. Content text may be placed in a
* "content" member. Comments, prologs, DTDs, and <pre>{@code
* &lt;[ [ ]]>}</pre>
* are ignored.
*
* All numbers are converted as strings, for 1, 01, 29.0 will not be coerced to
* numbers but will instead be the exact value as seen in the XML document depending
* on how flag is set.
* All booleans are converted as strings, for true, false will not be coerced to
* booleans but will instead be the exact value as seen in the XML document depending
* on how flag is set.
*
* @param reader The XML source reader.
* @param keepNumberAsString If true, then numeric values will not be coerced into
* numeric values and will instead be left as strings
* @param keepBooleanAsString If true, then boolean values will not be coerced into
* * numeric values and will instead be left as strings
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException Thrown if there is an errors while parsing the string
*/
public static JSONObject toJSONObject(Reader reader, boolean keepNumberAsString, boolean keepBooleanAsString) throws JSONException {
XMLParserConfiguration xmlParserConfiguration = new XMLParserConfiguration();
if(keepNumberAsString) {
xmlParserConfiguration = xmlParserConfiguration.withKeepNumberAsString(keepNumberAsString);
}
if(keepBooleanAsString) {
xmlParserConfiguration = xmlParserConfiguration.withKeepBooleanAsString(keepBooleanAsString);
}
return toJSONObject(reader, xmlParserConfiguration);
}
/**
* Convert a well-formed (but not necessarily valid) XML into a
* JSONObject. Some information may be lost in this transformation because
@@ -806,38 +746,6 @@ public class XML {
return toJSONObject(new StringReader(string), keepStrings);
}
/**
* Convert a well-formed (but not necessarily valid) XML string into a
* JSONObject. Some information may be lost in this transformation because
* JSON is a data format and XML is a document format. XML uses elements,
* attributes, and content text, while JSON uses unordered collections of
* name/value pairs and arrays of values. JSON does not does not like to
* distinguish between elements and attributes. Sequences of similar
* elements are represented as JSONArrays. Content text may be placed in a
* "content" member. Comments, prologs, DTDs, and <pre>{@code
* &lt;[ [ ]]>}</pre>
* are ignored.
*
* All numbers are converted as strings, for 1, 01, 29.0 will not be coerced to
* numbers but will instead be the exact value as seen in the XML document depending
* on how flag is set.
* All booleans are converted as strings, for true, false will not be coerced to
* booleans but will instead be the exact value as seen in the XML document depending
* on how flag is set.
*
* @param string
* The source string.
* @param keepNumberAsString If true, then numeric values will not be coerced into
* numeric values and will instead be left as strings
* @param keepBooleanAsString If true, then boolean values will not be coerced into
* numeric values and will instead be left as strings
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException Thrown if there is an errors while parsing the string
*/
public static JSONObject toJSONObject(String string, boolean keepNumberAsString, boolean keepBooleanAsString) throws JSONException {
return toJSONObject(new StringReader(string), keepNumberAsString, keepBooleanAsString);
}
/**
* Convert a well-formed (but not necessarily valid) XML string into a
* JSONObject. Some information may be lost in this transformation because

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.
*/
@@ -22,16 +22,6 @@ public class XMLParserConfiguration extends ParserConfiguration {
*/
// public static final int DEFAULT_MAXIMUM_NESTING_DEPTH = 512; // We could override
/**
* Allow user to control how numbers are parsed
*/
private boolean keepNumberAsString;
/**
* Allow user to control how booleans are parsed
*/
private boolean keepBooleanAsString;
/** Original Configuration of the XML Parser. */
public static final XMLParserConfiguration ORIGINAL
= new XMLParserConfiguration();
@@ -152,9 +142,7 @@ public class XMLParserConfiguration extends ParserConfiguration {
*/
@Deprecated
public XMLParserConfiguration (final boolean keepStrings, final String cDataTagName, final boolean convertNilAttributeToNull) {
super(false, DEFAULT_MAXIMUM_NESTING_DEPTH);
this.keepNumberAsString = keepStrings;
this.keepBooleanAsString = keepStrings;
super(keepStrings, DEFAULT_MAXIMUM_NESTING_DEPTH);
this.cDataTagName = cDataTagName;
this.convertNilAttributeToNull = convertNilAttributeToNull;
}
@@ -175,10 +163,8 @@ public class XMLParserConfiguration extends ParserConfiguration {
*/
private XMLParserConfiguration (final boolean keepStrings, final String cDataTagName,
final boolean convertNilAttributeToNull, final Map<String, XMLXsiTypeConverter<?>> xsiTypeMap, final Set<String> forceList,
final int maxNestingDepth, final boolean closeEmptyTag, final boolean keepNumberAsString, final boolean keepBooleanAsString) {
super(false, maxNestingDepth);
this.keepNumberAsString = keepNumberAsString;
this.keepBooleanAsString = keepBooleanAsString;
final int maxNestingDepth, final boolean closeEmptyTag) {
super(keepStrings, maxNestingDepth);
this.cDataTagName = cDataTagName;
this.convertNilAttributeToNull = convertNilAttributeToNull;
this.xsiTypeMap = Collections.unmodifiableMap(xsiTypeMap);
@@ -203,9 +189,7 @@ public class XMLParserConfiguration extends ParserConfiguration {
this.xsiTypeMap,
this.forceList,
this.maxNestingDepth,
this.closeEmptyTag,
this.keepNumberAsString,
this.keepBooleanAsString
this.closeEmptyTag
);
config.shouldTrimWhiteSpace = this.shouldTrimWhiteSpace;
return config;
@@ -223,43 +207,7 @@ public class XMLParserConfiguration extends ParserConfiguration {
@SuppressWarnings("unchecked")
@Override
public XMLParserConfiguration withKeepStrings(final boolean newVal) {
XMLParserConfiguration newConfig = this.clone();
newConfig.keepStrings = newVal;
newConfig.keepNumberAsString = newVal;
newConfig.keepBooleanAsString = newVal;
return newConfig;
}
/**
* When parsing the XML into JSON, specifies if numbers should be kept as strings (<code>1</code>), or if
* they should try to be guessed into JSON values (numeric, boolean, string)
*
* @param newVal
* new value to use for the <code>keepNumberAsString</code> configuration option.
*
* @return The existing configuration will not be modified. A new configuration is returned.
*/
public XMLParserConfiguration withKeepNumberAsString(final boolean newVal) {
XMLParserConfiguration newConfig = this.clone();
newConfig.keepNumberAsString = newVal;
newConfig.keepStrings = newConfig.keepBooleanAsString && newConfig.keepNumberAsString;
return newConfig;
}
/**
* When parsing the XML into JSON, specifies if booleans should be kept as strings (<code>true</code>), or if
* they should try to be guessed into JSON values (numeric, boolean, string)
*
* @param newVal
* new value to use for the <code>withKeepBooleanAsString</code> configuration option.
*
* @return The existing configuration will not be modified. A new configuration is returned.
*/
public XMLParserConfiguration withKeepBooleanAsString(final boolean newVal) {
XMLParserConfiguration newConfig = this.clone();
newConfig.keepBooleanAsString = newVal;
newConfig.keepStrings = newConfig.keepBooleanAsString && newConfig.keepNumberAsString;
return newConfig;
return super.withKeepStrings(newVal);
}
/**
@@ -273,26 +221,6 @@ public class XMLParserConfiguration extends ParserConfiguration {
return this.cDataTagName;
}
/**
* When parsing the XML into JSONML, specifies if numbers should be kept as strings (<code>true</code>), or if
* they should try to be guessed into JSON values (numeric, boolean, string).
*
* @return The <code>keepStrings</code> configuration value.
*/
public boolean isKeepNumberAsString() {
return this.keepNumberAsString;
}
/**
* When parsing the XML into JSONML, specifies if booleans should be kept as strings (<code>true</code>), or if
* they should try to be guessed into JSON values (numeric, boolean, string).
*
* @return The <code>keepStrings</code> configuration value.
*/
public boolean isKeepBooleanAsString() {
return this.keepBooleanAsString;
}
/**
* The name of the key in a JSON Object that indicates a CDATA section. Historically this has
* been the value "content" but can be changed. Use <code>null</code> to indicate no CDATA

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.

View File

@@ -1,4 +1,4 @@
package org.json;
package org.json.compat;
/*
Public Domain.
*/

View File

@@ -1,392 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import org.junit.Test;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.CDL;
/**
* Tests for CDL.java.
* CDL provides an application level API, but it is not used by the
* reference app. To test it, strings will be converted to JSON-Java classes
* and then converted back.
*/
public class CDLTest {
/**
* String of lines where the column names are in the first row,
* and all subsequent rows are values. All keys and values should be legal.
*/
private static final String LINES = "Col 1, Col 2, \tCol 3, Col 4, Col 5, Col 6, Col 7\n" +
"val1, val2, val3, val4, val5, val6, val7\n" +
"1, 2, 3, 4\t, 5, 6, 7\n" +
"true, false, true, true, false, false, false\n" +
"0.23, 57.42, 5e27, -234.879, 2.34e5, 0.0, 9e-3\n" +
"\"va\tl1\", \"v\bal2\", \"val3\", \"val\f4\", \"val5\", \"va'l6\", val7\n";
/**
* CDL.toJSONArray() adds all values as strings, with no filtering or
* conversions. For testing, this means that the expected JSONObject
* values all must be quoted in the cases where the JSONObject parsing
* might normally convert the value into a non-string.
*/
private static final String EXPECTED_LINES =
"[ " +
"{" +
"\"Col 1\":\"val1\", " +
"\"Col 2\":\"val2\", " +
"\"Col 3\":\"val3\", " +
"\"Col 4\":\"val4\", " +
"\"Col 5\":\"val5\", " +
"\"Col 6\":\"val6\", " +
"\"Col 7\":\"val7\"" +
"}, " +
" {" +
"\"Col 1\":\"1\", " +
"\"Col 2\":\"2\", " +
"\"Col 3\":\"3\", " +
"\"Col 4\":\"4\", " +
"\"Col 5\":\"5\", " +
"\"Col 6\":\"6\", " +
"\"Col 7\":\"7\"" +
"}, " +
" {" +
"\"Col 1\":\"true\", " +
"\"Col 2\":\"false\", " +
"\"Col 3\":\"true\", " +
"\"Col 4\":\"true\", " +
"\"Col 5\":\"false\", " +
"\"Col 6\":\"false\", " +
"\"Col 7\":\"false\"" +
"}, " +
"{" +
"\"Col 1\":\"0.23\", " +
"\"Col 2\":\"57.42\", " +
"\"Col 3\":\"5e27\", " +
"\"Col 4\":\"-234.879\", " +
"\"Col 5\":\"2.34e5\", " +
"\"Col 6\":\"0.0\", " +
"\"Col 7\":\"9e-3\"" +
"}, " +
"{" +
"\"Col 1\":\"va\tl1\", " +
"\"Col 2\":\"v\bal2\", " +
"\"Col 3\":\"val3\", " +
"\"Col 4\":\"val\f4\", " +
"\"Col 5\":\"val5\", " +
"\"Col 6\":\"va'l6\", " +
"\"Col 7\":\"val7\"" +
"}" +
"]";
/**
* Attempts to create a JSONArray from a null string.
* Expect a NullPointerException.
*/
@Test(expected=NullPointerException.class)
public void exceptionOnNullString() {
String nullStr = null;
CDL.toJSONArray(nullStr);
}
/**
* Attempts to create a JSONArray from a string with unbalanced quotes
* in column title line. Expects a JSONException.
*/
@Test
public void unbalancedQuoteInName() {
String badLine = "Col1, \"Col2\nVal1, Val2";
try {
CDL.toJSONArray(badLine);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Missing close quote '\"'. at 12 [character 0 line 2]",
e.getMessage());
}
}
/**
* Attempts to create a JSONArray from a string with unbalanced quotes
* in value line. Expects a JSONException.
*/
@Test
public void unbalancedQuoteInValue() {
String badLine = "Col1, Col2\n\"Val1, Val2";
try {
CDL.toJSONArray(badLine);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Missing close quote '\"'. at 22 [character 11 line 2]",
e.getMessage());
}
}
/**
* Attempts to create a JSONArray from a string with null char
* in column title line. Expects a JSONException.
*/
@Test
public void nullInName() {
String badLine = "C\0ol1, Col2\nVal1, Val2";
try {
CDL.toJSONArray(badLine);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Bad character 'o' (111). at 2 [character 3 line 1]",
e.getMessage());
}
}
/**
* Attempt to create a JSONArray with unbalanced quotes and a properly escaped doubled quote.
* Expects a JSONException.
*/
@Test
public void unbalancedEscapedQuote(){
String badLine = "Col1, Col2\n\"Val1, \"\"Val2\"\"";
try {
CDL.toJSONArray(badLine);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Missing close quote '\"'. at 26 [character 15 line 2]",
e.getMessage());
}
}
/**
* Csv parsing skip last row if last field of this row is empty #943
*/
@Test
public void csvParsingCatchesLastRow(){
String data = "Field 1,Field 2,Field 3\n" +
"value11,value12,\n" +
"value21,value22,";
JSONArray jsonArray = CDL.toJSONArray(data);
JSONArray expectedJsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("Field 1", "value11");
jsonObject.put("Field 2", "value12");
jsonObject.put("Field 3", "");
expectedJsonArray.put(jsonObject);
jsonObject = new JSONObject();
jsonObject.put("Field 1", "value21");
jsonObject.put("Field 2", "value22");
jsonObject.put("Field 3", "");
expectedJsonArray.put(jsonObject);
Util.compareActualVsExpectedJsonArrays(jsonArray, expectedJsonArray);
}
/**
* Assert that there is no error for a single escaped quote within a properly embedded quote.
*/
@Test
public void singleEscapedQuote(){
String singleEscape = "Col1, Col2\nVal1, \"\"\"Val2\"";
JSONArray jsonArray = CDL.toJSONArray(singleEscape);
String cdlStr = CDL.toString(jsonArray);
assertTrue(cdlStr.contains("Col1"));
assertTrue(cdlStr.contains("Col2"));
assertTrue(cdlStr.contains("Val1"));
assertTrue(cdlStr.contains("\"Val2"));
}
/**
* Assert that there is no error for a single escaped quote within a properly
* embedded quote when not the last value.
*/
@Test
public void singleEscapedQuoteMiddleString(){
String singleEscape = "Col1, Col2\nVal1, \"\"\"Val2\"\nVal 3,Val 4";
JSONArray jsonArray = CDL.toJSONArray(singleEscape);
String cdlStr = CDL.toString(jsonArray);
assertTrue(cdlStr.contains("Col1"));
assertTrue(cdlStr.contains("Col2"));
assertTrue(cdlStr.contains("Val1"));
assertTrue(cdlStr.contains("\"Val2"));
}
/**
* Attempt to create a JSONArray with an escape quote and no enclosing quotes.
* Expects a JSONException.
*/
@Test
public void badEscapedQuote(){
String badLine = "Col1, Col2\nVal1, \"\"Val2";
try {
CDL.toJSONArray(badLine);
fail("Expecting an exception");
} catch (JSONException e) {
//System.out.println("Message" + e.getMessage());
assertEquals("Expecting an exception message",
"Bad character 'V' (86). at 20 [character 9 line 2]",
e.getMessage());
}
}
/**
* call toString with a null array
*/
@Test(expected=NullPointerException.class)
public void nullJSONArrayToString() {
CDL.toString((JSONArray)null);
}
/**
* Create a JSONArray from an empty string
*/
@Test
public void emptyString() {
String emptyStr = "";
JSONArray jsonArray = CDL.toJSONArray(emptyStr);
assertNull("CDL should return null when the input string is empty", jsonArray);
}
/**
* Create a JSONArray with only 1 row
*/
@Test
public void onlyColumnNames() {
String columnNameStr = "col1, col2, col3";
JSONArray jsonArray = CDL.toJSONArray(columnNameStr);
assertNull("CDL should return null when only 1 row is given",
jsonArray);
}
/**
* Create a JSONArray from string containing only whitespace and commas
*/
@Test
public void emptyLinesToJSONArray() {
String str = " , , , \n , , , ";
JSONArray jsonArray = CDL.toJSONArray(str);
assertNull("JSONArray should be null for no content",
jsonArray);
}
/**
* call toString with a null array
*/
@Test
public void emptyJSONArrayToString() {
JSONArray jsonArray = new JSONArray();
String str = CDL.toString(jsonArray);
assertNull("CDL should return null for toString(null)",
str);
}
/**
* call toString with a null arrays for names and values
*/
@Test
public void nullJSONArraysToString() {
String str = CDL.toString(null, null);
assertNull("CDL should return null for toString(null)",
str);
}
/**
* Given a JSONArray that was not built by CDL, some chars may be
* found that would otherwise be filtered out by CDL.
*/
@Test
public void checkSpecialChars() {
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonArray.put(jsonObject);
// \r will be filtered from name
jsonObject.put("Col \r1", "V1");
// \r will be filtered from value
jsonObject.put("Col 2", "V2\r");
assertEquals("expected length should be 1", 1, jsonArray.length());
String cdlStr = CDL.toString(jsonArray);
jsonObject = jsonArray.getJSONObject(0);
assertTrue(cdlStr.contains("\"Col 1\""));
assertTrue(cdlStr.contains("Col 2"));
assertTrue(cdlStr.contains("V1"));
assertTrue(cdlStr.contains("\"V2\""));
}
/**
* Create a JSONArray from a string of lines
*/
@Test
public void textToJSONArray() {
JSONArray jsonArray = CDL.toJSONArray(LINES);
JSONArray expectedJsonArray = new JSONArray(EXPECTED_LINES);
Util.compareActualVsExpectedJsonArrays(jsonArray, expectedJsonArray);
}
@Test
public void textToJSONArrayPipeDelimited() {
char delimiter = '|';
JSONArray jsonArray = CDL.toJSONArray(LINES.replaceAll(",", String.valueOf(delimiter)), delimiter);
JSONArray expectedJsonArray = new JSONArray(EXPECTED_LINES);
Util.compareActualVsExpectedJsonArrays(jsonArray, expectedJsonArray);
}
/**
* Create a JSONArray from a JSONArray of titles and a
* string of value lines
*/
@Test
public void jsonArrayToJSONArray() {
String nameArrayStr = "[\"Col1\", \"Col2\"]";
String values = "V1, V2";
JSONArray nameJSONArray = new JSONArray(nameArrayStr);
JSONArray jsonArray = CDL.toJSONArray(nameJSONArray, values);
JSONArray expectedJsonArray = new JSONArray("[{\"Col1\":\"V1\",\"Col2\":\"V2\"}]");
Util.compareActualVsExpectedJsonArrays(jsonArray, expectedJsonArray);
}
/**
* Create a JSONArray from a string of lines,
* then convert to string and then back to JSONArray
*/
@Test
public void textToJSONArrayAndBackToString() {
JSONArray jsonArray = CDL.toJSONArray(LINES);
String jsonStr = CDL.toString(jsonArray);
JSONArray finalJsonArray = CDL.toJSONArray(jsonStr);
JSONArray expectedJsonArray = new JSONArray(EXPECTED_LINES);
Util.compareActualVsExpectedJsonArrays(finalJsonArray, expectedJsonArray);
}
/**
* Create a JSONArray from a string of lines,
* then convert to string and then back to JSONArray
* with a custom delimiter
*/
@Test
public void textToJSONArrayAndBackToStringCustomDelimiter() {
JSONArray jsonArray = CDL.toJSONArray(LINES, ',');
String jsonStr = CDL.toString(jsonArray, ';');
JSONArray finalJsonArray = CDL.toJSONArray(jsonStr, ';');
JSONArray expectedJsonArray = new JSONArray(EXPECTED_LINES);
Util.compareActualVsExpectedJsonArrays(finalJsonArray, expectedJsonArray);
}
}

View File

@@ -1,190 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import java.util.*;
import org.json.*;
import org.junit.Test;
import com.jayway.jsonpath.*;
/**
* HTTP cookie specification RFC6265: http://tools.ietf.org/html/rfc6265
* <p>
* A cookie list is a JSONObject whose members are presumed to be cookie
* name/value pairs. Entries are unescaped while being added, and escaped in
* the toString() output.
* Unescaping means to convert %hh hex strings to the ascii equivalent
* and converting '+' to ' '.
* Escaping converts '+', '%', '=', ';' and ascii control chars to %hh hex strings.
* <p>
* CookieList should not be considered as just a list of Cookie objects:<br>
* - CookieList stores a cookie name/value pair as a single entry; Cookie stores
* it as 2 entries (key="name" and key="value").<br>
* - CookieList requires multiple name/value pairs as input; Cookie allows the
* 'secure' name with no associated value<br>
* - CookieList has no special handling for attribute name/value pairs.<br>
*/
public class CookieListTest {
/**
* Attempts to create a CookieList from a null string.
* Expects a NullPointerException.
*/
@Test(expected=NullPointerException.class)
public void nullCookieListException() {
String cookieStr = null;
CookieList.toJSONObject(cookieStr);
}
/**
* Attempts to create a CookieList from a malformed string.
* Expects a JSONException.
*/
@Test
public void malFormedCookieListException() {
String cookieStr = "thisCookieHasNoEqualsChar";
try {
CookieList.toJSONObject(cookieStr);
fail("should throw an exception");
} catch (JSONException e) {
/**
* Not sure of the missing char, but full string compare fails
*/
assertEquals("Expecting an exception message",
"Expected '=' and instead saw '' at 25 [character 26 line 1]",
e.getMessage());
}
}
/**
* Creates a CookieList from an empty string.
*/
@Test
public void emptyStringCookieList() {
String cookieStr = "";
JSONObject jsonObject = CookieList.toJSONObject(cookieStr);
assertTrue(jsonObject.isEmpty());
}
/**
* CookieList with the simplest cookie - a name/value pair with no delimiter.
*/
@Test
public void simpleCookieList() {
String cookieStr = "SID=31d4d96e407aad42";
JSONObject jsonObject = CookieList.toJSONObject(cookieStr);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("Expected 1 top level item", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 1);
assertTrue("expected 31d4d96e407aad42", "31d4d96e407aad42".equals(jsonObject.query("/SID")));
}
/**
* CookieList with a single a cookie which has a name/value pair and delimiter.
*/
@Test
public void simpleCookieListWithDelimiter() {
String cookieStr = "SID=31d4d96e407aad42;";
JSONObject jsonObject = CookieList.toJSONObject(cookieStr);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("Expected 1 top level item", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 1);
assertTrue("expected 31d4d96e407aad42", "31d4d96e407aad42".equals(jsonObject.query("/SID")));
}
/**
* CookieList with multiple cookies consisting of name/value pairs
* with delimiters.
*/
@Test
public void multiPartCookieList() {
String cookieStr =
"name1=myCookieValue1; "+
" name2=myCookieValue2;"+
"name3=myCookieValue3;"+
" name4=myCookieValue4; "+
"name5=myCookieValue5;"+
" name6=myCookieValue6;";
JSONObject jsonObject = CookieList.toJSONObject(cookieStr);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("Expected 6 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 6);
assertTrue("expected myCookieValue1", "myCookieValue1".equals(jsonObject.query("/name1")));
assertTrue("expected myCookieValue2", "myCookieValue2".equals(jsonObject.query("/name2")));
assertTrue("expected myCookieValue3", "myCookieValue3".equals(jsonObject.query("/name3")));
assertTrue("expected myCookieValue4", "myCookieValue4".equals(jsonObject.query("/name4")));
assertTrue("expected myCookieValue5", "myCookieValue5".equals(jsonObject.query("/name5")));
assertTrue("expected myCookieValue6", "myCookieValue6".equals(jsonObject.query("/name6")));
}
/**
* CookieList from a JSONObject with valid key and null value
*/
@Test
public void convertCookieListWithNullValueToString() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("key", JSONObject.NULL);
String cookieToStr = CookieList.toString(jsonObject);
assertTrue("toString() should be empty", "".equals(cookieToStr));
}
/**
* CookieList with multiple entries converted to a JSON document.
*/
@Test
public void convertCookieListToString() {
String cookieStr =
"name1=myCookieValue1; "+
" name2=myCookieValue2;"+
"name3=myCookieValue3;"+
" name4=myCookieValue4; "+
"name5=myCookieValue5;"+
" name6=myCookieValue6;";
JSONObject jsonObject = CookieList.toJSONObject(cookieStr);
// exercise CookieList.toString()
String cookieListString = CookieList.toString(jsonObject);
// have to convert it back for validation
jsonObject = CookieList.toJSONObject(cookieListString);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("Expected 6 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 6);
assertTrue("expected myCookieValue1", "myCookieValue1".equals(jsonObject.query("/name1")));
assertTrue("expected myCookieValue2", "myCookieValue2".equals(jsonObject.query("/name2")));
assertTrue("expected myCookieValue3", "myCookieValue3".equals(jsonObject.query("/name3")));
assertTrue("expected myCookieValue4", "myCookieValue4".equals(jsonObject.query("/name4")));
assertTrue("expected myCookieValue5", "myCookieValue5".equals(jsonObject.query("/name5")));
assertTrue("expected myCookieValue6", "myCookieValue6".equals(jsonObject.query("/name6")));
}
/**
* CookieList with multiple entries and some '+' chars and URL-encoded
* values converted to a JSON document.
*/
@Test
public void convertEncodedCookieListToString() {
String cookieStr =
"name1=myCookieValue1; "+
" name2=my+Cookie+Value+2;"+
"name3=my%2BCookie%26Value%3B3%3D;"+
" name4=my%25CookieValue4; "+
"name5=myCookieValue5;"+
" name6=myCookieValue6;";
JSONObject jsonObject = CookieList.toJSONObject(cookieStr);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("Expected 6 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 6);
assertTrue("expected myCookieValue1", "myCookieValue1".equals(jsonObject.query("/name1")));
assertTrue("expected my Cookie Value 2", "my Cookie Value 2".equals(jsonObject.query("/name2")));
assertTrue("expected my+Cookie&Value;3=", "my+Cookie&Value;3=".equals(jsonObject.query("/name3")));
assertTrue("expected my%CookieValue4", "my%CookieValue4".equals(jsonObject.query("/name4")));
assertTrue("expected my%CookieValue5", "myCookieValue5".equals(jsonObject.query("/name5")));
assertTrue("expected myCookieValue6", "myCookieValue6".equals(jsonObject.query("/name6")));
}
}

View File

@@ -1,242 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import org.json.*;
import org.junit.Test;
/**
* HTTP cookie specification: RFC6265
* <p>
* At its most basic, a cookie is a name=value pair. The value may be subdivided
* into other cookies, but that is not tested here. The cookie may also include
* certain named attributes, delimited by semicolons.
* <p>
* The Cookie.toString() method emits certain attributes if present: expires,
* domain, path, secure. All but secure are name-value pairs. Other attributes
* are not included in the toString() output.
* <p>
* A JSON-Java encoded cookie escapes '+', '%', '=', ';' with %hh values.
*/
public class CookieTest {
/**
* Attempts to create a JSONObject from a null string.
* Expects a NullPointerException.
*/
@Test(expected=NullPointerException.class)
public void nullCookieException() {
String cookieStr = null;
Cookie.toJSONObject(cookieStr);
}
/**
* Attempts to create a JSONObject from a cookie string with
* no '=' char.
* Expects a JSONException.
*/
@Test
public void malFormedNameValueException() {
String cookieStr = "thisCookieHasNoEqualsChar";
try {
Cookie.toJSONObject(cookieStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Expected '=' and instead saw '' at 25 [character 26 line 1]",
e.getMessage());
}
}
/**
* Attempts to create a JSONObject from a cookie string
* with embedded ';' char.
* Expects a JSONException.
*/
@Test
public void booleanAttribute() {
String cookieStr = "this=Cookie;myAttribute";
JSONObject jo = Cookie.toJSONObject(cookieStr);
assertTrue("has key 'name'", jo.has("name"));
assertTrue("has key 'value'", jo.has("value"));
assertTrue("has key 'myAttribute'", jo.has("myattribute"));
}
/**
* Attempts to create a JSONObject from an empty cookie string.<br>
* Note: Cookie throws an exception, but CookieList does not.<br>
* Expects a JSONException
*/
@Test
public void emptyStringCookieException() {
String cookieStr = "";
try {
Cookie.toJSONObject(cookieStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Cookies must have a 'name'",
e.getMessage());
}
}
/**
*
* Attempts to create a JSONObject from an cookie string where the name is blank.<br>
* Note: Cookie throws an exception, but CookieList does not.<br>
* Expects a JSONException
*/
@Test
public void emptyNameCookieException() {
String cookieStr = " = value ";
try {
Cookie.toJSONObject(cookieStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Cookies must have a 'name'",
e.getMessage());
}
}
/**
* Cookie from a simple name/value pair with no delimiter
*/
@Test
public void simpleCookie() {
String cookieStr = "SID=31d4d96e407aad42";
String expectedCookieStr = "{\"name\":\"SID\",\"value\":\"31d4d96e407aad42\"}";
JSONObject jsonObject = Cookie.toJSONObject(cookieStr);
JSONObject expectedJsonObject = new JSONObject(expectedCookieStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
}
/**
* Store a cookie with all of the supported attributes in a
* JSONObject. The secure attribute, which has no value, is treated
* as a boolean.
*/
@Test
public void multiPartCookie() {
String cookieStr =
"PH=deleted; "+
" expires=Wed, 19-Mar-2014 17:53:53 GMT;"+
"path=/; "+
" domain=.yahoo.com;"+
"secure";
String expectedCookieStr =
"{"+
"\"name\":\"PH\","+
"\"value\":\"deleted\","+
"\"path\":\"/\","+
"\"expires\":\"Wed, 19-Mar-2014 17:53:53 GMT\","+
"\"domain\":\".yahoo.com\","+
"\"secure\":true"+
"}";
JSONObject jsonObject = Cookie.toJSONObject(cookieStr);
JSONObject expectedJsonObject = new JSONObject(expectedCookieStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
}
/**
* Cookie.toString() will emit the non-standard "thiswont=beIncluded"
* attribute, and the attribute is still stored in the JSONObject.
* This test confirms both behaviors.
*/
@Test
public void convertCookieToString() {
String cookieStr =
"PH=deleted; "+
" expires=Wed, 19-Mar-2014 17:53:53 GMT;"+
"path=/; "+
" domain=.yahoo.com;"+
"thisWont=beIncluded;"+
"secure";
String expectedCookieStr =
"{\"thiswont\":\"beIncluded\","+
"\"path\":\"/\","+
"\"expires\":\"Wed, 19-Mar-2014 17:53:53 GMT\","+
"\"domain\":\".yahoo.com\","+
"\"name\":\"PH\","+
"\"secure\":true,"+
"\"value\":\"deleted\"}";
// Add the nonstandard attribute to the expected cookie string
String expectedDirectCompareCookieStr = expectedCookieStr;
// convert all strings into JSONObjects
JSONObject jsonObject = Cookie.toJSONObject(cookieStr);
JSONObject expectedJsonObject = new JSONObject(expectedCookieStr);
JSONObject expectedDirectCompareJsonObject =
new JSONObject(expectedDirectCompareCookieStr);
// emit the string
String cookieToStr = Cookie.toString(jsonObject);
// create a final JSONObject from the string
JSONObject finalJsonObject = Cookie.toJSONObject(cookieToStr);
// JSONObject should contain the nonstandard string
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedDirectCompareJsonObject);
// JSONObject -> string -> JSONObject should not contain the nonstandard string
Util.compareActualVsExpectedJsonObjects(finalJsonObject,expectedJsonObject);
}
/**
* A string may be URL-encoded when converting to JSONObject.
* If found, '+' is converted to ' ', and %hh hex strings are converted
* to their ascii char equivalents. This test confirms the decoding
* behavior.
*/
@Test
public void convertEncodedCookieToString() {
String cookieStr =
"PH=deleted; "+
" expires=Wed,+19-Mar-2014+17:53:53+GMT;"+
"path=/%2Bthis/is%26/a/spec%3Bsegment%3D; "+
" domain=.yahoo.com;"+
"secure";
String expectedCookieStr =
"{\"path\":\"/+this/is&/a/spec;segment=\","+
"\"expires\":\"Wed, 19-Mar-2014 17:53:53 GMT\","+
"\"domain\":\".yahoo.com\","+
"\"name\":\"PH\","+
"\"secure\":true,"+
"\"value\":\"deleted\"}";
JSONObject jsonObject = Cookie.toJSONObject(cookieStr);
JSONObject expectedJsonObject = new JSONObject(expectedCookieStr);
String cookieToStr = Cookie.toString(jsonObject);
JSONObject finalJsonObject = Cookie.toJSONObject(cookieToStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
Util.compareActualVsExpectedJsonObjects(finalJsonObject,expectedJsonObject);
}
/**
* A public API method performs a URL encoding for selected chars
* in a string. Control chars, '+', '%', '=', ';' are all encoded
* as %hh hex strings. The string is also trimmed.
* This test confirms that behavior.
*/
@Test
public void escapeString() {
String str = " +%\r\n\t\b%=;;; ";
String expectedStr = "%2b%25%0d%0a%09%08%25%3d%3b%3b%3b";
String actualStr = Cookie.escape(str);
assertTrue("expect escape() to encode correctly. Actual: " +actualStr+
" expected: " +expectedStr, expectedStr.equals(actualStr));
}
/**
* A public API method performs URL decoding for strings.
* '+' is converted to space and %hh hex strings are converted to
* their ascii equivalent values. The string is not trimmed.
* This test confirms that behavior.
*/
@Test
public void unescapeString() {
String str = " +%2b%25%0d%0a%09%08%25%3d%3b%3b%3b+ ";
String expectedStr = " +%\r\n\t\b%=;;; ";
String actualStr = Cookie.unescape(str);
assertTrue("expect unescape() to decode correctly. Actual: " +actualStr+
" expected: " +expectedStr, expectedStr.equals(actualStr));
}
}

View File

@@ -1,433 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.junit.data.MyEnum;
import org.json.junit.data.MyEnumClass;
import org.json.junit.data.MyEnumField;
import org.junit.Test;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.JsonPath;
/**
* Enums are not explicitly supported in JSON-Java. But because enums act like
* classes, all required behavior is already be present in some form.
* These tests explore how enum serialization works with JSON-Java.
*/
public class EnumTest {
/**
* To serialize an enum by its getters, use the JSONObject Object constructor.
* The JSONObject ctor handles enum like any other bean. A JSONobject
* is created whose entries are the getter name/value pairs.
*/
@Test
public void jsonObjectFromEnum() {
// If there are no getters then the object is empty.
MyEnum myEnum = MyEnum.VAL2;
JSONObject jsonObject = new JSONObject(myEnum);
assertTrue("simple enum has no getters", jsonObject.isEmpty());
// enum with a getters should create a non-empty object
MyEnumField myEnumField = MyEnumField.VAL2;
jsonObject = new JSONObject(myEnumField);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider()
.parse(jsonObject.toString());
assertTrue("expecting 2 items in top level object", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expecting val 2", "val 2".equals(jsonObject.query("/value")));
assertTrue("expecting 2", Integer.valueOf(2).equals(jsonObject.query("/intVal")));
/**
* class which contains enum instances. Each enum should be stored
* in its own JSONObject
*/
MyEnumClass myEnumClass = new MyEnumClass();
myEnumClass.setMyEnum(MyEnum.VAL1);
myEnumClass.setMyEnumField(MyEnumField.VAL3);
jsonObject = new JSONObject(myEnumClass);
// validate JSON content
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 2 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expected 2 myEnumField items", "VAL3".equals((JsonPath.read(doc, "$.myEnumField"))));
assertTrue("expected 0 myEnum items", "VAL1".equals((JsonPath.read(doc, "$.myEnum"))));
assertTrue("expecting MyEnumField.VAL3", MyEnumField.VAL3.equals(jsonObject.query("/myEnumField")));
assertTrue("expecting MyEnum.VAL1", MyEnum.VAL1.equals(jsonObject.query("/myEnum")));
}
/**
* To serialize an enum by its set of allowed values, use getNames()
* and the JSONObject Object with names constructor.
*/
@Test
public void jsonObjectFromEnumWithNames() {
String [] names;
JSONObject jsonObject;
MyEnum myEnum = MyEnum.VAL1;
names = JSONObject.getNames(myEnum);
// The values will be MyEnum fields
jsonObject = new JSONObject(myEnum, names);
// validate JSON object
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 3 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 3);
assertTrue("expected VAL1", MyEnum.VAL1.equals(jsonObject.query("/VAL1")));
assertTrue("expected VAL2", MyEnum.VAL2.equals(jsonObject.query("/VAL2")));
assertTrue("expected VAL3", MyEnum.VAL3.equals(jsonObject.query("/VAL3")));
MyEnumField myEnumField = MyEnumField.VAL3;
names = JSONObject.getNames(myEnumField);
// The values will be MyEnmField fields
jsonObject = new JSONObject(myEnumField, names);
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 3 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 3);
assertTrue("expected VAL1", MyEnumField.VAL1.equals(jsonObject.query("/VAL1")));
assertTrue("expected VAL2", MyEnumField.VAL2.equals(jsonObject.query("/VAL2")));
assertTrue("expected VAL3", MyEnumField.VAL3.equals(jsonObject.query("/VAL3")));
}
/**
* Verify that enums are handled consistently between JSONArray and JSONObject
*/
@Test
public void verifyEnumConsistency(){
JSONObject jo = new JSONObject();
jo.put("value", MyEnumField.VAL2);
String expected="{\"value\":\"VAL2\"}";
String actual = jo.toString();
assertTrue("Expected "+expected+" but actual was "+actual, expected.equals(actual));
jo.accumulate("value", MyEnumField.VAL1);
expected="{\"value\":[\"VAL2\",\"VAL1\"]}";
actual = jo.toString();
assertTrue("Expected "+expected+" but actual was "+actual, expected.equals(actual));
jo.remove("value");
jo.append("value", MyEnumField.VAL1);
expected="{\"value\":[\"VAL1\"]}";
actual = jo.toString();
assertTrue("Expected "+expected+" but actual was "+actual, expected.equals(actual));
jo.put("value", EnumSet.of(MyEnumField.VAL2));
expected="{\"value\":[\"VAL2\"]}";
actual = jo.toString();
assertTrue("Expected "+expected+" but actual was "+actual, expected.equals(actual));
JSONArray ja = new JSONArray();
ja.put(MyEnumField.VAL2);
jo.put("value", ja);
actual = jo.toString();
assertTrue("Expected "+expected+" but actual was "+actual, expected.equals(actual));
jo.put("value", new MyEnumField[]{MyEnumField.VAL2});
actual = jo.toString();
assertTrue("Expected "+expected+" but actual was "+actual, expected.equals(actual));
}
/**
* To serialize by assigned value, use the put() methods. The value
* will be stored as a enum type.
*/
@Test
public void enumPut() {
JSONObject jsonObject = new JSONObject();
MyEnum myEnum = MyEnum.VAL2;
jsonObject.put("myEnum", myEnum);
MyEnumField myEnumField = MyEnumField.VAL1;
jsonObject.putOnce("myEnumField", myEnumField);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 2 top level objects", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expected VAL2", MyEnum.VAL2.equals(jsonObject.query("/myEnum")));
assertTrue("expected VAL1", MyEnumField.VAL1.equals(jsonObject.query("/myEnumField")));
JSONArray jsonArray = new JSONArray();
jsonArray.put(myEnum);
jsonArray.put(1, myEnumField);
// validate JSON content
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonArray.toString());
assertTrue("expected 2 top level objects", ((List<?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expected VAL2", MyEnum.VAL2.equals(jsonArray.query("/0")));
assertTrue("expected VAL1", MyEnumField.VAL1.equals(jsonArray.query("/1")));
/**
* Leaving these tests because they exercise get, opt, and remove
*/
assertTrue("expecting myEnum value", MyEnum.VAL2.equals(jsonArray.get(0)));
assertTrue("expecting myEnumField value", MyEnumField.VAL1.equals(jsonArray.opt(1)));
assertTrue("expecting myEnumField value", MyEnumField.VAL1.equals(jsonArray.remove(1)));
}
/**
* The default action of valueToString() is to call object.toString().
* For enums, this means the assigned value will be returned as a string.
*/
@Test
public void enumValueToString() {
String expectedStr1 = "\"VAL1\"";
String expectedStr2 = "\"VAL1\"";
MyEnum myEnum = MyEnum.VAL1;
MyEnumField myEnumField = MyEnumField.VAL1;
MyEnumClass myEnumClass = new MyEnumClass();
String str1 = JSONObject.valueToString(myEnum);
assertTrue("actual myEnum: "+str1+" expected: "+expectedStr1,
str1.equals(expectedStr1));
String str2 = JSONObject.valueToString(myEnumField);
assertTrue("actual myEnumField: "+str2+" expected: "+expectedStr2,
str2.equals(expectedStr2));
/**
* However, an enum within another class will not be rendered
* unless that class overrides default toString()
*/
String expectedStr3 = "\"org.json.junit.data.MyEnumClass@";
myEnumClass.setMyEnum(MyEnum.VAL1);
myEnumClass.setMyEnumField(MyEnumField.VAL1);
String str3 = JSONObject.valueToString(myEnumClass);
assertTrue("actual myEnumClass: "+str3+" expected: "+expectedStr3,
str3.startsWith(expectedStr3));
}
/**
* In whatever form the enum was added to the JSONObject or JSONArray,
* json[Object|Array].toString should serialize it in a reasonable way.
*/
@Test
public void enumToString() {
MyEnum myEnum = MyEnum.VAL2;
JSONObject jsonObject = new JSONObject(myEnum);
String expectedStr = "{}";
assertTrue("myEnum toString() should be empty", expectedStr.equals(jsonObject.toString()));
MyEnumField myEnumField = MyEnumField.VAL2;
jsonObject = new JSONObject(myEnumField);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 2 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expected val 2", "val 2".equals(jsonObject.query("/value")));
assertTrue("expected 2", Integer.valueOf(2).equals(jsonObject.query("/intVal")));
MyEnumClass myEnumClass = new MyEnumClass();
myEnumClass.setMyEnum(MyEnum.VAL1);
myEnumClass.setMyEnumField(MyEnumField.VAL3);
jsonObject = new JSONObject(myEnumClass);
// validate JSON content
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 2 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expected VAL3", "VAL3".equals((JsonPath.read(doc, "$.myEnumField"))));
assertTrue("expected VAL1", "VAL1".equals((JsonPath.read(doc, "$.myEnum"))));
String [] names = JSONObject.getNames(myEnum);
jsonObject = new JSONObject(myEnum, names);
// validate JSON content
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 3 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 3);
assertTrue("expected VAL1", MyEnum.VAL1.equals(jsonObject.query("/VAL1")));
assertTrue("expected VAL2", MyEnum.VAL2.equals(jsonObject.query("/VAL2")));
assertTrue("expected VAL3", MyEnum.VAL3.equals(jsonObject.query("/VAL3")));
names = JSONObject.getNames(myEnumField);
jsonObject = new JSONObject(myEnumField, names);
// validate JSON content
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 3 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 3);
assertTrue("expected VAL1", MyEnumField.VAL1.equals(jsonObject.query("/VAL1")));
assertTrue("expected VAL2", MyEnumField.VAL2.equals(jsonObject.query("/VAL2")));
assertTrue("expected VAL3", MyEnumField.VAL3.equals(jsonObject.query("/VAL3")));
expectedStr = "{\"myEnum\":\"VAL2\", \"myEnumField\":\"VAL2\"}";
jsonObject = new JSONObject();
jsonObject.putOpt("myEnum", myEnum);
jsonObject.putOnce("myEnumField", myEnumField);
// validate JSON content
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 2 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expected VAL2", MyEnum.VAL2.equals(jsonObject.query("/myEnum")));
assertTrue("expected VAL2", MyEnumField.VAL2.equals(jsonObject.query("/myEnumField")));
JSONArray jsonArray = new JSONArray();
jsonArray.put(myEnum);
jsonArray.put(1, myEnumField);
// validate JSON content
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonArray.toString());
assertTrue("expected 2 top level items", ((List<?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expected VAL2", MyEnum.VAL2.equals(jsonArray.query("/0")));
assertTrue("expected VAL2", MyEnumField.VAL2.equals(jsonArray.query("/1")));
}
/**
* Wrap should handle enums exactly as a value type like Integer, Boolean, or String.
*/
@Test
public void wrap() {
assertTrue("simple enum has no getters", JSONObject.wrap(MyEnum.VAL2) instanceof MyEnum);
MyEnumField myEnumField = MyEnumField.VAL2;
JSONObject jsonObject = new JSONObject();
jsonObject.put("enum",myEnumField);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 1 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 1);
assertTrue("expected VAL2", MyEnumField.VAL2.equals(jsonObject.query("/enum")));
MyEnumClass myEnumClass = new MyEnumClass();
myEnumClass.setMyEnum(MyEnum.VAL1);
myEnumClass.setMyEnumField(MyEnumField.VAL3);
jsonObject = (JSONObject)JSONObject.wrap(myEnumClass);
// validate JSON content
doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 2 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 2);
assertTrue("expected VAL3", "VAL3".equals((JsonPath.read(doc, "$.myEnumField"))));
assertTrue("expected VAL1", "VAL1".equals((JsonPath.read(doc, "$.myEnum"))));
assertTrue("expecting MyEnumField.VAL3", MyEnumField.VAL3.equals(jsonObject.query("/myEnumField")));
assertTrue("expecting MyEnum.VAL1", MyEnum.VAL1.equals(jsonObject.query("/myEnum")));
}
/**
* It was determined that some API methods should be added to
* support enums:<br>
* JSONObject.getEnum(class, key)<br>
* JSONObject.optEnum(class, key)<br>
* JSONObject.optEnum(class, key, default)<br>
* JSONArray.getEnum(class, index)<br>
* JSONArray.optEnum(class, index)<br>
* JSONArray.optEnum(class, index, default)<br>
* <p>
* Exercise these enum API methods on JSONObject and JSONArray
*/
@Test
public void enumAPI() {
MyEnumClass myEnumClass = new MyEnumClass();
myEnumClass.setMyEnum(MyEnum.VAL1);
MyEnumField myEnumField = MyEnumField.VAL2;
JSONObject jsonObject = new JSONObject();
jsonObject.put("strKey", "value");
jsonObject.put("strKey2", "VAL1");
jsonObject.put("enumKey", myEnumField);
jsonObject.put("enumClassKey", myEnumClass);
// get a plain old enum
MyEnumField actualEnum = jsonObject.getEnum(MyEnumField.class, "enumKey");
assertTrue("get myEnumField", actualEnum == MyEnumField.VAL2);
// try to get the wrong value
try {
actualEnum = jsonObject.getEnum(MyEnumField.class, "strKey");
assertTrue("should throw an exception for wrong key", false);
} catch (Exception ignored) {}
// get a class that contains an enum
MyEnumClass actualEnumClass = (MyEnumClass)jsonObject.get("enumClassKey");
assertTrue("get enum", actualEnumClass.getMyEnum() == MyEnum.VAL1);
// opt a plain old enum
actualEnum = jsonObject.optEnum(MyEnumField.class, "enumKey");
assertTrue("opt myEnumField", actualEnum == MyEnumField.VAL2);
// opt the wrong value
actualEnum = jsonObject.optEnum(MyEnumField.class, "strKey");
assertTrue("opt null", actualEnum == null);
// opt a class that contains an enum
actualEnumClass = (MyEnumClass)jsonObject.opt("enumClassKey");
assertTrue("get enum", actualEnumClass.getMyEnum() == MyEnum.VAL1);
// opt with default a plain old enum
actualEnum = jsonObject.optEnum(MyEnumField.class, "enumKey", null);
assertTrue("opt myEnumField", actualEnum == MyEnumField.VAL2);
// opt with default the wrong value
actualEnum = jsonObject.optEnum(MyEnumField.class, "strKey", null);
assertNull("opt null", actualEnum);
// opt with default the string value
actualEnum = jsonObject.optEnum(MyEnumField.class, "strKey2", null);
assertEquals(MyEnumField.VAL1, actualEnum);
// opt with default an index that does not exist
actualEnum = jsonObject.optEnum(MyEnumField.class, "noKey", null);
assertNull("opt null", actualEnum);
assertNull("Expected Null when the enum class is null",
jsonObject.optEnum(null, "enumKey"));
/**
* Exercise the proposed enum API methods on JSONArray
*/
JSONArray jsonArray = new JSONArray();
jsonArray.put("value");
jsonArray.put(myEnumField);
jsonArray.put(myEnumClass);
// get a plain old enum
actualEnum = jsonArray.getEnum(MyEnumField.class, 1);
assertTrue("get myEnumField", actualEnum == MyEnumField.VAL2);
// try to get the wrong value
try {
actualEnum = jsonArray.getEnum(MyEnumField.class, 0);
assertTrue("should throw an exception for wrong index", false);
} catch (Exception ignored) {}
// get a class that contains an enum
actualEnumClass = (MyEnumClass)jsonArray.get(2);
assertTrue("get enum", actualEnumClass.getMyEnum() == MyEnum.VAL1);
// opt a plain old enum
actualEnum = jsonArray.optEnum(MyEnumField.class, 1);
assertTrue("opt myEnumField", actualEnum == MyEnumField.VAL2);
// opt the wrong value
actualEnum = jsonArray.optEnum(MyEnumField.class, 0);
assertTrue("opt null", actualEnum == null);
// opt a class that contains an enum
actualEnumClass = (MyEnumClass)jsonArray.opt(2);
assertTrue("get enum", actualEnumClass.getMyEnum() == MyEnum.VAL1);
// opt with default a plain old enum
actualEnum = jsonArray.optEnum(MyEnumField.class, 1, null);
assertTrue("opt myEnumField", actualEnum == MyEnumField.VAL2);
// opt with default the wrong value
actualEnum = jsonArray.optEnum(MyEnumField.class, 0, null);
assertTrue("opt null", actualEnum == null);
// opt with default an index that does not exist
actualEnum = jsonArray.optEnum(MyEnumField.class, 3, null);
assertTrue("opt null", actualEnum == null);
}
}

View File

@@ -1,200 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import org.json.*;
import org.junit.Test;
/**
* Unit tests for JSON-Java HTTP.java. See RFC7230.
*/
public class HTTPTest {
/**
* Attempt to call HTTP.toJSONObject() with a null string
* Expects a NUllPointerException.
*/
@Test(expected=NullPointerException.class)
public void nullHTTPException() {
String httpStr = null;
HTTP.toJSONObject(httpStr);
}
/**
* Attempt to call HTTP.toJSONObject() with a string containing
* an empty object. Expects a JSONException.
*/
@Test
public void notEnoughHTTPException() {
String httpStr = "{}";
JSONObject jsonObject = new JSONObject(httpStr);
try {
HTTP.toString(jsonObject);
assertTrue("Expected to throw exception", false);
} catch (JSONException e) {
assertTrue("Expecting an exception message",
"Not enough material for an HTTP header.".equals(e.getMessage()));
}
}
/**
* Calling HTTP.toJSONObject() with an empty string will result in a
* populated JSONObject with keys but no values for Request-URI, Method,
* and HTTP-Version.
*/
@Test
public void emptyStringHTTPRequest() {
String httpStr = "";
String expectedHTTPStr = "{\"Request-URI\":\"\",\"Method\":\"\",\"HTTP-Version\":\"\"}";
JSONObject jsonObject = HTTP.toJSONObject(httpStr);
JSONObject expectedJsonObject = new JSONObject(expectedHTTPStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
}
/**
* Call HTTP.toJSONObject() with a Request-URI, Method,
* and HTTP-Version.
*/
@Test
public void simpleHTTPRequest() {
String httpStr = "GET /hello.txt HTTP/1.1";
String expectedHTTPStr =
"{\"Request-URI\":\"/hello.txt\",\"Method\":\"GET\",\"HTTP-Version\":\"HTTP/1.1\"}";
JSONObject jsonObject = HTTP.toJSONObject(httpStr);
JSONObject expectedJsonObject = new JSONObject(expectedHTTPStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
}
/**
* Call HTTP.toJSONObject() with a response string containing a
* HTTP-Version, Status-Code, and Reason.
*/
@Test
public void simpleHTTPResponse() {
String httpStr = "HTTP/1.1 200 OK";
String expectedHTTPStr =
"{\"HTTP-Version\":\"HTTP/1.1\",\"Status-Code\":\"200\",\"Reason-Phrase\":\"OK\"}";
JSONObject jsonObject = HTTP.toJSONObject(httpStr);
JSONObject expectedJsonObject = new JSONObject(expectedHTTPStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
}
/**
* Call HTTP.toJSONObject() with a full request string including
* request headers.
*/
@Test
public void extendedHTTPRequest() {
String httpStr =
"POST /enlighten/calais.asmx HTTP/1.1\n"+
"Host: api.opencalais.com\n"+
"Content-Type: text/xml; charset=utf-8\n"+
"Content-Length: 100\n"+
"SOAPAction: \"http://clearforest.com/Enlighten\"";
String expectedHTTPStr =
"{"+
"\"Request-URI\":\"/enlighten/calais.asmx\","+
"\"Host\":\"api.opencalais.com\","+
"\"Method\":\"POST\","+
"\"HTTP-Version\":\"HTTP/1.1\","+
"\"Content-Length\":\"100\","+
"\"Content-Type\":\"text/xml; charset=utf-8\"}";
JSONObject jsonObject = HTTP.toJSONObject(httpStr);
JSONObject expectedJsonObject = new JSONObject(expectedHTTPStr);
/**
* Not too easy for JSONObject to parse a string with embedded quotes.
* For the sake of the test, add it here.
*/
expectedJsonObject.put("SOAPAction","\"http://clearforest.com/Enlighten\"");
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
}
/**
* Call HTTP.toJSONObject() with a full response string including
* response headers.
*/
@Test
public void extendedHTTPResponse() {
String httpStr =
"HTTP/1.1 200 OK\n"+
"Content-Type: text/xml; charset=utf-8\n"+
"Content-Length: 100\n";
String expectedHTTPStr =
"{\"HTTP-Version\":\"HTTP/1.1\","+
"\"Status-Code\":\"200\","+
"\"Content-Length\":\"100\","+
"\"Reason-Phrase\":\"OK\","+
"\"Content-Type\":\"text/xml; charset=utf-8\"}";
JSONObject jsonObject = HTTP.toJSONObject(httpStr);
JSONObject expectedJsonObject = new JSONObject(expectedHTTPStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
}
/**
* Call HTTP.toJSONObject() with a full POST request string including
* response headers, then convert it back into an HTTP string.
*/
@Test
public void convertHTTPRequestToString() {
String httpStr =
"POST /enlighten/calais.asmx HTTP/1.1\n"+
"Host: api.opencalais.com\n"+
"Content-Type: text/xml; charset=utf-8\n"+
"Content-Length: 100";
String expectedHTTPStr =
"{"+
"\"Request-URI\":\"/enlighten/calais.asmx\","+
"\"Host\":\"api.opencalais.com\","+
"\"Method\":\"POST\","+
"\"HTTP-Version\":\"HTTP/1.1\","+
"\"Content-Length\":\"100\","+
"\"Content-Type\":\"text/xml; charset=utf-8\"}";
JSONObject jsonObject = HTTP.toJSONObject(httpStr);
JSONObject expectedJsonObject = new JSONObject(expectedHTTPStr);
String httpToStr = HTTP.toString(jsonObject);
/**
* JSONObject objects to crlfs and any trailing chars.
* For the sake of the test, simplify the resulting string
*/
httpToStr = httpToStr.replaceAll("("+HTTP.CRLF+HTTP.CRLF+")", "");
httpToStr = httpToStr.replaceAll(HTTP.CRLF, "\n");
JSONObject finalJsonObject = HTTP.toJSONObject(httpToStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
Util.compareActualVsExpectedJsonObjects(finalJsonObject,expectedJsonObject);
}
/**
* Call HTTP.toJSONObject() with a full response string including
* response headers, then convert it back into an HTTP string.
*/
@Test
public void convertHTTPResponseToString() {
String httpStr =
"HTTP/1.1 200 OK\n"+
"Content-Type: text/xml; charset=utf-8\n"+
"Content-Length: 100\n";
String expectedHTTPStr =
"{\"HTTP-Version\":\"HTTP/1.1\","+
"\"Status-Code\":\"200\","+
"\"Content-Length\":\"100\","+
"\"Reason-Phrase\":\"OK\","+
"\"Content-Type\":\"text/xml; charset=utf-8\"}";
JSONObject jsonObject = HTTP.toJSONObject(httpStr);
JSONObject expectedJsonObject = new JSONObject(expectedHTTPStr);
String httpToStr = HTTP.toString(jsonObject);
/**
* JSONObject objects to crlfs and any trailing chars.
* For the sake of the test, simplify the resulting string
*/
httpToStr = httpToStr.replaceAll("("+HTTP.CRLF+HTTP.CRLF+")", "");
httpToStr = httpToStr.replaceAll(HTTP.CRLF, "\n");
JSONObject finalJsonObject = HTTP.toJSONObject(httpToStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
Util.compareActualVsExpectedJsonObjects(finalJsonObject,expectedJsonObject);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,989 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import org.json.*;
import org.junit.Test;
/**
* Tests for org.json.JSONML.java
*
* Certain inputs are expected to result in exceptions. These tests are
* executed first. JSONML provides an API to:
* Convert an XML string into a JSONArray or a JSONObject.
* Convert a JSONArray or JSONObject into an XML string.
* Both fromstring and tostring operations operations should be symmetrical
* within the limits of JSONML.
* It should be possible to perform the following operations, which should
* result in the original string being recovered, within the limits of the
* underlying classes:
* Convert a string -> JSONArray -> string -> JSONObject -> string
* Convert a string -> JSONObject -> string -> JSONArray -> string
*
*/
public class JSONMLTest {
/**
* Attempts to transform a null XML string to JSON.
* Expects a NullPointerException
*/
@Test(expected=NullPointerException.class)
public void nullXMLException() {
String xmlStr = null;
JSONML.toJSONArray(xmlStr);
}
/**
* Attempts to transform an empty string to JSON.
* Expects a JSONException
*/
@Test
public void emptyXMLException() {
String xmlStr = "";
try {
JSONML.toJSONArray(xmlStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Bad XML at 0 [character 1 line 1]",
e.getMessage());
}
}
/**
* Attempts to call JSONML.toString() with a null JSONArray.
* Expects a NullPointerException.
*/
@Test(expected=NullPointerException.class)
public void nullJSONXMLException() {
/**
* Tries to convert a null JSONArray to XML.
*/
JSONArray jsonArray= null;
JSONML.toString(jsonArray);
}
/**
* Attempts to call JSONML.toString() with a null JSONArray.
* Expects a JSONException.
*/
@Test
public void emptyJSONXMLException() {
/**
* Tries to convert an empty JSONArray to XML.
*/
JSONArray jsonArray = new JSONArray();
try {
JSONML.toString(jsonArray);
assertTrue("Expecting an exception", false);
} catch (JSONException e) {
assertTrue("Expecting an exception message",
"JSONArray[0] not found.".
equals(e.getMessage()));
}
}
/**
* Attempts to transform an non-XML string to JSON.
* Expects a JSONException
*/
@Test
public void nonXMLException() {
/**
* Attempts to transform a nonXML string to JSON
*/
String xmlStr = "{ \"this is\": \"not xml\"}";
try {
JSONML.toJSONArray(xmlStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Bad XML at 23 [character 24 line 1]",
e.getMessage());
}
}
/**
* Attempts to transform a JSON document with XML content that
* does not follow JSONML conventions (element name is not first value
* in a nested JSONArray) to a JSONArray then back to string.
* Expects a JSONException
*/
@Test
public void emptyTagException() {
/**
* jsonArrayStr is used to build a JSONArray which is then
* turned into XML. For this transformation, all arrays represent
* elements and the first array entry is the name of the element.
* In this case, one of the arrays does not have a name
*/
String jsonArrayStr =
"[\"addresses\","+
"{\"xsi:noNamespaceSchemaLocation\":\"test.xsd\","+
"\"xmlns:xsi\":\"http://www.w3.org/2001/XMLSchema-instance\"},"+
// this array has no name
"["+
"[\"name\"],"+
"[\"nocontent\"],"+
"\">\""+
"]"+
"]";
JSONArray jsonArray = new JSONArray(jsonArrayStr);
try {
JSONML.toString(jsonArray);
assertTrue("Expecting an exception", false);
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"JSONArray[0] is not a String (class org.json.JSONArray).",
e.getMessage());
}
}
/**
* Attempts to transform a JSON document with XML content that
* does not follow JSONML conventions (element tag has an embedded space)
* to a JSONArray then back to string. Expects a JSONException
*/
@Test
public void spaceInTagException() {
/**
* jsonArrayStr is used to build a JSONArray which is then
* turned into XML. For this transformation, all arrays represent
* elements and the first array entry is the name of the element.
* In this case, one of the element names has an embedded space,
* which is not allowed.
*/
String jsonArrayStr =
"[\"addresses\","+
"{\"xsi:noNamespaceSchemaLocation\":\"test.xsd\","+
"\"xmlns:xsi\":\"http://www.w3.org/2001/XMLSchema-instance\"},"+
// this array has an invalid name
"[\"addr esses\","+
"[\"name\"],"+
"[\"nocontent\"],"+
"\">\""+
"]"+
"]";
JSONArray jsonArray = new JSONArray(jsonArrayStr);
try {
JSONML.toString(jsonArray);
assertTrue("Expecting an exception", false);
} catch (JSONException e) {
assertTrue("Expecting an exception message",
"'addr esses' contains a space character.".
equals(e.getMessage()));
}
}
/**
* Attempts to transform a malformed XML document
* (element tag has a frontslash) to a JSONArray.\
* Expects a JSONException
*/
@Test
public void invalidSlashInTagException() {
/**
* xmlStr contains XML text which is transformed into a JSONArray.
* In this case, the XML is invalid because the 'name' element
* contains an invalid frontslash.
*/
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
" xsi:noNamespaceSchemaLocation='test.xsd'>\n"+
" <address>\n"+
" <name/x>\n"+
" <street>abc street</street>\n"+
" </address>\n"+
"</addresses>";
try {
JSONML.toJSONArray(xmlStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Misshaped tag at 176 [character 14 line 4]",
e.getMessage());
}
}
/**
* Malformed XML text (invalid tagname) is transformed into a JSONArray.
* Expects a JSONException.
*/
@Test
public void invalidBangInTagException() {
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
" xsi:noNamespaceSchemaLocation='test.xsd'>\n"+
" <address>\n"+
" <name/>\n"+
" <!>\n"+
" </address>\n"+
"</addresses>";
try {
JSONML.toJSONArray(xmlStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Misshaped meta tag at 215 [character 12 line 7]",
e.getMessage());
}
}
/**
* Malformed XML text (invalid tagname, no close bracket) is transformed\
* into a JSONArray. Expects a JSONException.
*/
@Test
public void invalidBangNoCloseInTagException() {
/**
* xmlStr contains XML text which is transformed into a JSONArray.
* In this case, the XML is invalid because an element
* starts with '!' and has no closing tag
*/
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
" xsi:noNamespaceSchemaLocation='test.xsd'>\n"+
" <address>\n"+
" <name/>\n"+
" <!\n"+
" </address>\n"+
"</addresses>";
try {
JSONML.toJSONArray(xmlStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Misshaped meta tag at 214 [character 12 line 7]",
e.getMessage());
}
}
/**
* Malformed XML text (tagname with no close bracket) is transformed\
* into a JSONArray. Expects a JSONException.
*/
@Test
public void noCloseStartTagException() {
/**
* xmlStr contains XML text which is transformed into a JSONArray.
* In this case, the XML is invalid because an element
* has no closing '>'.
*/
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
" xsi:noNamespaceSchemaLocation='test.xsd'>\n"+
" <address>\n"+
" <name/>\n"+
" <abc\n"+
" </address>\n"+
"</addresses>";
try {
JSONML.toJSONArray(xmlStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Misplaced '<' at 194 [character 5 line 6]",
e.getMessage());
}
}
/**
* Malformed XML text (endtag with no name) is transformed\
* into a JSONArray. Expects a JSONException.
*/
@Test
public void noCloseEndTagException() {
/**
* xmlStr contains XML text which is transformed into a JSONArray.
* In this case, the XML is invalid because an element
* has no name after the closing tag '</'.
*/
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
" xsi:noNamespaceSchemaLocation='test.xsd'>\n"+
" <address>\n"+
" <name/>\n"+
" <abc/>\n"+
" </>\n"+
"</addresses>";
try {
JSONML.toJSONArray(xmlStr);
assertTrue("Expecting an exception", false);
} catch (JSONException e) {
assertTrue("Expecting an exception message",
"Expected a closing name instead of '>'.".
equals(e.getMessage()));
}
}
/**
* Malformed XML text (endtag with no close bracket) is transformed\
* into a JSONArray. Expects a JSONException.
*/
@Test
public void noCloseEndBraceException() {
/**
* xmlStr contains XML text which is transformed into a JSONArray.
* In this case, the XML is invalid because an element
* has '>' after the closing tag '</' and name.
*/
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
" xsi:noNamespaceSchemaLocation=\"test.xsd\">\n"+
" <address>\n"+
" <name/>\n"+
" <abc/>\n"+
" </address\n"+
"</addresses>";
try {
JSONML.toJSONArray(xmlStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Misplaced '<' at 206 [character 1 line 7]",
e.getMessage());
}
}
/**
* Malformed XML text (incomplete CDATA string) is transformed\
* into a JSONArray. Expects a JSONException.
*/
@Test
public void invalidCDATABangInTagException() {
/**
* xmlStr contains XML text which is transformed into a JSONArray.
* In this case, the XML is invalid because an element
* does not have a complete CDATA string.
*/
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
" xsi:noNamespaceSchemaLocation='test.xsd'>\n"+
" <address>\n"+
" <name>Joe Tester</name>\n"+
" <![[]>\n"+
" </address>\n"+
"</addresses>";
try {
JSONML.toJSONArray(xmlStr);
fail("Expecting an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"Expected 'CDATA[' at 204 [character 11 line 5]",
e.getMessage());
}
}
/**
* Convert an XML document into a JSONArray, then use JSONML.toString()
* to convert it into a string. This string is then converted back into
* a JSONArray. Both JSONArrays are compared against a control to
* confirm the contents.
*/
@Test
public void toJSONArray() {
/**
* xmlStr contains XML text which is transformed into a JSONArray.
* Each element becomes a JSONArray:
* 1st entry = elementname
* 2nd entry = attributes object (if present)
* 3rd entry = content (if present)
* 4th entry = child element JSONArrays (if present)
* The result is compared against an expected JSONArray.
* The transformed JSONArray is then transformed back into a string
* which is used to create a final JSONArray, which is also compared
* against the expected JSONArray.
*/
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
"xsi:noNamespaceSchemaLocation='test.xsd'>\n"+
"<address attr1=\"attrValue1\" attr2=\"attrValue2\" attr3=\"attrValue3\">\n"+
"<name nameType=\"mine\">myName</name>\n"+
"<nocontent/>>\n"+
"</address>\n"+
"</addresses>";
String expectedStr =
"[\"addresses\","+
"{\"xsi:noNamespaceSchemaLocation\":\"test.xsd\","+
"\"xmlns:xsi\":\"http://www.w3.org/2001/XMLSchema-instance\"},"+
"[\"address\","+
"{\"attr1\":\"attrValue1\",\"attr2\":\"attrValue2\",\"attr3\":\"attrValue3\"},"+
"[\"name\", {\"nameType\":\"mine\"},\"myName\"],"+
"[\"nocontent\"],"+
"\">\""+
"]"+
"]";
JSONArray jsonArray = JSONML.toJSONArray(xmlStr);
JSONArray expectedJsonArray = new JSONArray(expectedStr);
String xmlToStr = JSONML.toString(jsonArray);
JSONArray finalJsonArray = JSONML.toJSONArray(xmlToStr);
Util.compareActualVsExpectedJsonArrays(jsonArray, expectedJsonArray);
Util.compareActualVsExpectedJsonArrays(finalJsonArray, expectedJsonArray);
}
/**
* Convert an XML document into a JSONObject. Use JSONML.toString() to
* convert it back into a string, and then re-convert it into a JSONObject.
* Both JSONObjects are compared against a control JSONObject to confirm
* the contents.
* <p>
* Next convert the XML document into a JSONArray. Use JSONML.toString() to
* convert it back into a string, and then re-convert it into a JSONArray.
* Both JSONArrays are compared against a control JSONArray to confirm
* the contents.
* <p>
* This test gives a comprehensive example of how the JSONML
* transformations work.
*/
@Test
public void toJSONObjectToJSONArray() {
/**
* xmlStr contains XML text which is transformed into a JSONObject,
* restored to XML, transformed into a JSONArray, and then restored
* to XML again. Both JSONObject and JSONArray should contain the same
* information and should produce the same XML, allowing for non-ordered
* attributes.
*
* Transformation to JSONObject:
* The elementName is stored as a string where key="tagName"
* Attributes are simply stored as key/value pairs
* If the element has either content or child elements, they are stored
* in a jsonArray with key="childNodes".
*
* Transformation to JSONArray:
* 1st entry = elementname
* 2nd entry = attributes object (if present)
* 3rd entry = content (if present)
* 4th entry = child element JSONArrays (if present)
*/
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<addresses xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+
"xsi:noNamespaceSchemaLocation='test.xsd'>\n"+
"<address addrType=\"my address\">\n"+
"<name nameType=\"my name\">Joe Tester</name>\n"+
"<street><![CDATA[Baker street 5]]></street>\n"+
"<NothingHere except=\"an attribute\"/>\n"+
"<TrueValue>true</TrueValue>\n"+
"<FalseValue>false</FalseValue>\n"+
"<NullValue>null</NullValue>\n"+
"<PositiveValue>42</PositiveValue>\n"+
"<NegativeValue>-23</NegativeValue>\n"+
"<DoubleValue>-23.45</DoubleValue>\n"+
"<Nan>-23x.45</Nan>\n"+
"<ArrayOfNum>\n"+
"<value>1</value>\n"+
"<value>2</value>\n"+
"<value><subValue svAttr=\"svValue\">abc</subValue></value>\n"+
"<value>3</value>\n"+
"<value>4.1</value>\n"+
"<value>5.2</value>\n"+
"</ArrayOfNum>\n"+
"</address>\n"+
"</addresses>";
String expectedJSONObjectStr =
"{"+
"\"xsi:noNamespaceSchemaLocation\":\"test.xsd\","+
"\"childNodes\":["+
"{"+
"\"childNodes\":["+
"{"+
"\"childNodes\":[\"Joe Tester\"],"+
"\"nameType\":\"my name\","+
"\"tagName\":\"name\""+
"},"+
"{"+
"\"childNodes\":[\"Baker street 5\"],"+
"\"tagName\":\"street\""+
"},"+
"{"+
"\"tagName\":\"NothingHere\","+
"\"except\":\"an attribute\""+
"},"+
"{"+
"\"childNodes\":[true],"+
"\"tagName\":\"TrueValue\""+
"},"+
"{"+
"\"childNodes\":[false],"+
"\"tagName\":\"FalseValue\""+
"},"+
"{"+
"\"childNodes\":[null],"+
"\"tagName\":\"NullValue\""+
"},"+
"{"+
"\"childNodes\":[42],"+
"\"tagName\":\"PositiveValue\""+
"},"+
"{"+
"\"childNodes\":[-23],"+
"\"tagName\":\"NegativeValue\""+
"},"+
"{"+
"\"childNodes\":[-23.45],"+
"\"tagName\":\"DoubleValue\""+
"},"+
"{"+
"\"childNodes\":[\"-23x.45\"],"+
"\"tagName\":\"Nan\""+
"},"+
"{"+
"\"childNodes\":["+
"{"+
"\"childNodes\":[1],"+
"\"tagName\":\"value\""+
"},"+
"{"+
"\"childNodes\":[2],"+
"\"tagName\":\"value\""+
"},"+
"{"+
"\"childNodes\":["+
"{"+
"\"childNodes\":[\"abc\"],"+
"\"svAttr\":\"svValue\","+
"\"tagName\":\"subValue\""+
"}"+
"],"+
"\"tagName\":\"value\""+
"},"+
"{"+
"\"childNodes\":[3],"+
"\"tagName\":\"value\""+
"},"+
"{"+
"\"childNodes\":[4.1],"+
"\"tagName\":\"value\""+
"},"+
"{"+
"\"childNodes\":[5.2],"+
"\"tagName\":\"value\""+
"}"+
"],"+
"\"tagName\":\"ArrayOfNum\""+
"}"+
"],"+
"\"addrType\":\"my address\","+
"\"tagName\":\"address\""+
"}"+
"],"+
"\"xmlns:xsi\":\"http://www.w3.org/2001/XMLSchema-instance\","+
"\"tagName\":\"addresses\""+
"}";
String expectedJSONArrayStr =
"["+
"\"addresses\","+
"{"+
"\"xsi:noNamespaceSchemaLocation\":\"test.xsd\","+
"\"xmlns:xsi\":\"http://www.w3.org/2001/XMLSchema-instance\""+
"},"+
"["+
"\"address\","+
"{"+
"\"addrType\":\"my address\""+
"},"+
"["+
"\"name\","+
"{"+
"\"nameType\":\"my name\""+
"},"+
"\"Joe Tester\""+
"],"+
"[\"street\",\"Baker street 5\"],"+
"["+
"\"NothingHere\","+
"{\"except\":\"an attribute\"}"+
"],"+
"[\"TrueValue\",true],"+
"[\"FalseValue\",false],"+
"[\"NullValue\",null],"+
"[\"PositiveValue\",42],"+
"[\"NegativeValue\",-23],"+
"[\"DoubleValue\",-23.45],"+
"[\"Nan\",\"-23x.45\"],"+
"["+
"\"ArrayOfNum\","+
"[\"value\",1],"+
"[\"value\",2],"+
"[\"value\","+
"["+
"\"subValue\","+
"{\"svAttr\":\"svValue\"},"+
"\"abc\""+
"]"+
"],"+
"[\"value\",3],"+
"[\"value\",4.1],"+
"[\"value\",5.2]"+
"]"+
"]"+
"]";
// make a JSONObject and make sure it looks as expected
JSONObject jsonObject = JSONML.toJSONObject(xmlStr);
JSONObject expectedJsonObject = new JSONObject(expectedJSONObjectStr);
Util.compareActualVsExpectedJsonObjects(jsonObject,expectedJsonObject);
// restore the XML, then make another JSONObject and make sure it
// looks as expected
String jsonObjectXmlToStr = JSONML.toString(jsonObject);
JSONObject finalJsonObject = JSONML.toJSONObject(jsonObjectXmlToStr);
Util.compareActualVsExpectedJsonObjects(finalJsonObject, expectedJsonObject);
// create a JSON array from the original string and make sure it
// looks as expected
JSONArray jsonArray = JSONML.toJSONArray(xmlStr);
JSONArray expectedJsonArray = new JSONArray(expectedJSONArrayStr);
Util.compareActualVsExpectedJsonArrays(jsonArray,expectedJsonArray);
// restore the XML, then make another JSONArray and make sure it
// looks as expected
String jsonArrayXmlToStr = JSONML.toString(jsonArray);
JSONArray finalJsonArray = JSONML.toJSONArray(jsonArrayXmlToStr);
Util.compareActualVsExpectedJsonArrays(finalJsonArray, expectedJsonArray);
// lastly, confirm the restored JSONObject XML and JSONArray XML look
// reasonably similar
JSONObject jsonObjectFromObject = JSONML.toJSONObject(jsonObjectXmlToStr);
JSONObject jsonObjectFromArray = JSONML.toJSONObject(jsonArrayXmlToStr);
Util.compareActualVsExpectedJsonObjects(jsonObjectFromObject, jsonObjectFromArray);
}
/**
* Convert an XML document which contains embedded comments into
* a JSONArray. Use JSONML.toString() to turn it into a string, then
* reconvert it into a JSONArray. Compare both JSONArrays to a control
* JSONArray to confirm the contents.
* <p>
* This test shows how XML comments are handled.
*/
@Test
public void commentsInXML() {
String xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
"<!-- this is a comment -->\n"+
"<addresses>\n"+
"<address>\n"+
"<!-- <!--[CDATA[ this is -- <another> comment ]] -->\n"+
"<name>Joe Tester</name>\n"+
"<!-- this is a - multi line \n"+
"comment -->\n"+
"<street>Baker street 5</street>\n"+
"</address>\n"+
"</addresses>";
String expectedStr =
"[\"addresses\","+
"[\"address\","+
"[\"name\",\"Joe Tester\"],"+
"[\"street\",\"Baker street 5\"]"+
"]"+
"]";
JSONArray jsonArray = JSONML.toJSONArray(xmlStr);
JSONArray expectedJsonArray = new JSONArray(expectedStr);
String xmlToStr = JSONML.toString(jsonArray);
JSONArray finalJsonArray = JSONML.toJSONArray(xmlToStr);
Util.compareActualVsExpectedJsonArrays(jsonArray, expectedJsonArray);
Util.compareActualVsExpectedJsonArrays(finalJsonArray, expectedJsonArray);
}
/**
* JSON string with lost leading zero and converted "True" to true. See test
* result in comment below.
*/
@Test
public void testToJSONArray_jsonOutput() {
final String originalXml = "<root><id>01</id><id>1</id><id>00</id><id>0</id><item id=\"01\"/><title>True</title></root>";
final String expectedJsonString = "[\"root\",[\"id\",\"01\"],[\"id\",1],[\"id\",\"00\"],[\"id\",0],[\"item\",{\"id\":\"01\"}],[\"title\",true]]";
final JSONArray actualJsonOutput = JSONML.toJSONArray(originalXml, false);
assertEquals(expectedJsonString, actualJsonOutput.toString());
}
/**
* JSON string cannot be reverted to original xml when type guessing is used.
*/
@Test
public void testToJSONArray_reversibility() {
final String originalXml = "<root><id>01</id><id>1</id><id>00</id><id>0</id><item id=\"01\"/><title>True</title></root>";
final String revertedXml = JSONML.toString(JSONML.toJSONArray(originalXml, false));
assertNotEquals(revertedXml, originalXml);
}
/**
* JSON string cannot be reverted to original xml when type guessing is used.
* When we force all the values as string, the original text comes back.
*/
@Test
public void testToJSONArray_reversibility2() {
final String originalXml = "<root><id>01</id><id>1</id><id>00</id><id>0</id><item id=\"01\"/><title>True</title></root>";
final String expectedJsonString = "[\"root\",[\"id\",\"01\"],[\"id\",\"1\"],[\"id\",\"00\"],[\"id\",\"0\"],[\"item\",{\"id\":\"01\"}],[\"title\",\"True\"]]";
final JSONArray json = JSONML.toJSONArray(originalXml,true);
assertEquals(expectedJsonString, json.toString());
final String reverseXml = JSONML.toString(json);
assertEquals(originalXml, reverseXml);
}
/**
* JSON can be reverted to original xml.
*/
@Test
public void testToJSONArray_reversibility3() {
final String originalXml = "<readResult><errors someAttr=\"arrtValue\"><code>400</code></errors><errors><code>402</code></errors></readResult>";
final JSONArray jsonArray = JSONML.toJSONArray(originalXml, false);
final String revertedXml = JSONML.toString(jsonArray);
assertEquals(revertedXml, originalXml);
}
/**
* JSON string cannot be reverted to original xml. See test result in
* comment below.
*/
@Test
public void testToJSONObject_reversibility() {
final String originalXml = "<readResult><errors someAttr=\"arrtValue\"><code>400</code></errors><errors><code>402</code></errors></readResult>";
final JSONObject originalObject=JSONML.toJSONObject(originalXml,false);
final String originalJson = originalObject.toString();
final String xml = JSONML.toString(originalObject);
final JSONObject revertedObject = JSONML.toJSONObject(xml, false);
final String newJson = revertedObject.toString();
assertTrue("JSON Objects are not similar", originalObject.similar(revertedObject));
assertTrue("JSON Strings are not similar", new JSONObject(originalJson).similar(new JSONObject(newJson)));
}
// these tests do not pass for the following reasons:
// 1. Our XML parser does not handle generic HTML entities, only valid XML entities. Hence &nbsp;
// or other HTML specific entities would fail on reversability
// 2. Our JSON implementation for storing the XML attributes uses the standard unordered map.
// This means that <tag attr1="v1" attr2="v2" /> can not be reversed reliably.
//
// /**
// * Test texts taken from jsonml.org. Currently our implementation FAILS this conversion but shouldn't.
// * Technically JsonML should be able to transform any valid xhtml document, but ours only supports
// * standard XML entities, not HTML entities.
// */
// @Test
// public void testAttributeConversionReversabilityHTML() {
// final String originalXml = "<table class=\"MyTable\" style=\"background-color:yellow\"><tr><td class=\"MyTD\" style=\"border:1px solid black\">#5D28D1</td><td class=\"MyTD\" style=\"background-color:red\">Example text here</td></tr><tr><td class=\"MyTD\" style=\"border:1px solid black\">#AF44EF</td><td class=\"MyTD\" style=\"background-color:green\">127310656</td></tr><tr><td class=\"MyTD\" style=\"border:1px solid black\">#AAD034</td><td class=\"MyTD\" style=\"background-color:blue\">&nbsp;<span style=\"background-color:maroon\">&copy;</span>&nbsp;</td></tr></table>";
// final String expectedJsonString = "[\"table\",{\"class\" : \"MyTable\",\"style\" : \"background-color:yellow\"},[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#550758\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:red\"},\"Example text here\"]],[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#993101\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:green\"},\"127624015\"]],[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#E33D87\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:blue\"},\"\u00A0\",[\"span\",{ \"style\" : \"background-color:maroon\" },\"\u00A9\"],\"\u00A0\"]]]";
// final JSONArray json = JSONML.toJSONArray(originalXml,true);
// final String actualJsonString = json.toString();
//
// final String reverseXml = JSONML.toString(json);
// assertNotEquals(originalXml, reverseXml);
//
// assertNotEquals(expectedJsonString, actualJsonString);
// }
//
// /**
// * Test texts taken from jsonml.org but modified to have XML entities only.
// */
// @Test
// public void testAttributeConversionReversabilityXML() {
// final String originalXml = "<table class=\"MyTable\" style=\"background-color:yellow\"><tr><td class=\"MyTD\" style=\"border:1px solid black\">#5D28D1</td><td class=\"MyTD\" style=\"background-color:red\">Example text here</td></tr><tr><td class=\"MyTD\" style=\"border:1px solid black\">#AF44EF</td><td class=\"MyTD\" style=\"background-color:green\">127310656</td></tr><tr><td class=\"MyTD\" style=\"border:1px solid black\">#AAD034</td><td class=\"MyTD\" style=\"background-color:blue\">&amp;<span style=\"background-color:maroon\">&gt;</span>&lt;</td></tr></table>";
// final String expectedJsonString = "[\"table\",{\"class\" : \"MyTable\",\"style\" : \"background-color:yellow\"},[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#550758\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:red\"},\"Example text here\"]],[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#993101\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:green\"},\"127624015\"]],[\"tr\",[\"td\",{\"class\" : \"MyTD\",\"style\" : \"border:1px solid black\"},\"#E33D87\"],[\"td\",{\"class\" : \"MyTD\",\"style\" : \"background-color:blue\"},\"&\",[\"span\",{ \"style\" : \"background-color:maroon\" },\">\"],\"<\"]]]";
// final JSONArray jsonML = JSONML.toJSONArray(originalXml,true);
// final String actualJsonString = jsonML.toString();
//
// final String reverseXml = JSONML.toString(jsonML);
// // currently not equal because the hashing of the attribute objects makes the attribute
// // order not happen the same way twice
// assertEquals(originalXml, reverseXml);
//
// assertEquals(expectedJsonString, actualJsonString);
// }
@Test (timeout = 6000)
public void testIssue484InfinteLoop1() {
try {
JSONML.toJSONObject("??*^M??|?CglR^F??`??>?w??PIlr^E??D^X^]?$?-^R?o??O?*??{OD?^FY??`2a????NM?b^Tq?:O?>S$^K?J?^FB.gUK?m^H??zE??^??!v]?^A???^[^A??^U?c??????h???s???g^Z???`?q^Dbi??:^QZl?)?}1^??k?0??:$V?$?Ovs(}J??^V????2;^QgQ?^_^A?^D?^U?Tg?K?`?h%c?hmGA?<!C*^P^Y?^X9?~?t?)??,z^XA???S}?Q??.q?j????]");
fail("Exception expected for invalid JSON.");
} catch (JSONException ex) {
assertEquals("Exception string did not match: ",
"Unterminated string at 271 [character 272 line 1]",
ex.getMessage());
}
}
@Test (timeout = 6000)
public void testIssue484InfinteLoop2() {
try {
String input = "??*\n" +
"??|?CglR??`??>?w??PIlr??D?$?-?o??O?*??{OD?Y??`2a????NM?bq?:O?>S$ ?J?B.gUK?m\b??zE???!v]???????c??????h???s???g???`?qbi??:Zl?)?}1^??k?0??:$V?$?Ovs(}J??????2;gQ????Tg?K?`?h%c?hmGA?<!C*?9?~?t?)??,zA???S}?Q??.q?j????]";
JSONML.toJSONObject(input);
fail("Exception expected for invalid JSON.");
} catch (JSONException ex) {
assertEquals("Exception string did not match: ",
"Unterminated string at 242 [character 238 line 2]",
ex.getMessage());
}
}
@Test
public void testToJSONArrayMaxNestingDepthOf42IsRespected() {
final String wayTooLongMalformedXML = new String(new char[6000]).replace("\0", "<a>");
final int maxNestingDepth = 42;
try {
JSONML.toJSONArray(wayTooLongMalformedXML, JSONMLParserConfiguration.ORIGINAL.withMaxNestingDepth(maxNestingDepth));
fail("Expecting a JSONException");
} catch (JSONException e) {
assertTrue("Wrong throwable thrown: not expecting message <" + e.getMessage() + ">",
e.getMessage().startsWith("Maximum nesting depth of " + maxNestingDepth));
}
}
@Test
public void testToJSONArrayMaxNestingDepthIsRespectedWithValidXML() {
final String perfectlyFineXML = "<Test>\n" +
" <employee>\n" +
" <name>sonoo</name>\n" +
" <salary>56000</salary>\n" +
" <married>true</married>\n" +
" </employee>\n" +
"</Test>\n";
final int maxNestingDepth = 1;
try {
JSONML.toJSONArray(perfectlyFineXML, JSONMLParserConfiguration.ORIGINAL.withMaxNestingDepth(maxNestingDepth));
fail("Expecting a JSONException");
} catch (JSONException e) {
assertTrue("Wrong throwable thrown: not expecting message <" + e.getMessage() + ">",
e.getMessage().startsWith("Maximum nesting depth of " + maxNestingDepth));
}
}
@Test
public void testToJSONArrayMaxNestingDepthWithValidFittingXML() {
final String perfectlyFineXML = "<Test>\n" +
" <employee>\n" +
" <name>sonoo</name>\n" +
" <salary>56000</salary>\n" +
" <married>true</married>\n" +
" </employee>\n" +
"</Test>\n";
final int maxNestingDepth = 3;
try {
JSONML.toJSONArray(perfectlyFineXML, JSONMLParserConfiguration.ORIGINAL.withMaxNestingDepth(maxNestingDepth));
} catch (JSONException e) {
e.printStackTrace();
fail("XML document should be parsed as its maximum depth fits the maxNestingDepth " +
"parameter of the JSONMLParserConfiguration used");
}
}
@Test
public void testToJSONObjectMaxDefaultNestingDepthIsRespected() {
final String wayTooLongMalformedXML = new String(new char[6000]).replace("\0", "<a>");
try {
JSONML.toJSONObject(wayTooLongMalformedXML, JSONMLParserConfiguration.ORIGINAL);
fail("Expecting a JSONException");
} catch (JSONException e) {
assertTrue("Wrong throwable thrown: not expecting message <" + e.getMessage() + ">",
e.getMessage().startsWith("Maximum nesting depth of " + JSONMLParserConfiguration.DEFAULT_MAXIMUM_NESTING_DEPTH));
}
}
@Test
public void testToJSONObjectUnlimitedNestingDepthIsPossible() {
int actualDepth = JSONMLParserConfiguration.DEFAULT_MAXIMUM_NESTING_DEPTH +10;
final String deeperThanDefaultMax = new String(new char[actualDepth]).replace("\0", "<a>") +
"value" +
new String(new char[actualDepth]).replace("\0", "</a>");
try {
JSONML.toJSONObject(deeperThanDefaultMax, JSONMLParserConfiguration.ORIGINAL
.withMaxNestingDepth(JSONMLParserConfiguration.UNDEFINED_MAXIMUM_NESTING_DEPTH));
} catch (JSONException e) {
e.printStackTrace();
fail("XML document should be parsed beyond the default maximum depth if maxNestingDepth " +
"parameter is set to -1 in JSONMLParserConfiguration");
}
}
@Test
public void testToJSONObjectMaxNestingDepthOf42IsRespected() {
final String wayTooLongMalformedXML = new String(new char[6000]).replace("\0", "<a>");
final int maxNestingDepth = 42;
try {
JSONML.toJSONObject(wayTooLongMalformedXML, JSONMLParserConfiguration.ORIGINAL.withMaxNestingDepth(maxNestingDepth));
fail("Expecting a JSONException");
} catch (JSONException e) {
assertTrue("Wrong throwable thrown: not expecting message <" + e.getMessage() + ">",
e.getMessage().startsWith("Maximum nesting depth of " + maxNestingDepth));
}
}
@Test
public void testToJSONObjectMaxNestingDepthIsRespectedWithValidXML() {
final String perfectlyFineXML = "<Test>\n" +
" <employee>\n" +
" <name>sonoo</name>\n" +
" <salary>56000</salary>\n" +
" <married>true</married>\n" +
" </employee>\n" +
"</Test>\n";
final int maxNestingDepth = 1;
try {
JSONML.toJSONObject(perfectlyFineXML, JSONMLParserConfiguration.ORIGINAL.withMaxNestingDepth(maxNestingDepth));
fail("Expecting a JSONException");
} catch (JSONException e) {
assertTrue("Wrong throwable thrown: not expecting message <" + e.getMessage() + ">",
e.getMessage().startsWith("Maximum nesting depth of " + maxNestingDepth));
}
}
@Test
public void testToJSONObjectMaxNestingDepthWithValidFittingXML() {
final String perfectlyFineXML = "<Test>\n" +
" <employee>\n" +
" <name>sonoo</name>\n" +
" <salary>56000</salary>\n" +
" <married>true</married>\n" +
" </employee>\n" +
"</Test>\n";
final int maxNestingDepth = 3;
try {
JSONML.toJSONObject(perfectlyFineXML, JSONMLParserConfiguration.ORIGINAL.withMaxNestingDepth(maxNestingDepth));
} catch (JSONException e) {
e.printStackTrace();
fail("XML document should be parsed as its maximum depth fits the maxNestingDepth " +
"parameter of the JSONMLParserConfiguration used");
}
}
}

View File

@@ -1,60 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import java.util.*;
import org.json.*;
import org.json.junit.data.MyLocaleBean;
import org.junit.*;
/**
* Note: This file is saved as UTF-8. Do not save as ASCII or the tests will
* fail.
*
*/
public class JSONObjectLocaleTest {
/**
* JSONObject built from a bean with locale-specific keys.
* In the Turkish alphabet, there are 2 versions of the letter "i".
* 'eh' I ı (dotless i)
* 'ee' İ i (dotted i)
* A problem can occur when parsing the public get methods for a bean.
* If the method starts with getI... then the key name will be lowercased
* to 'i' in English, and 'ı' in Turkish.
* We want the keys to be consistent regardless of locale, so JSON-Java
* lowercase operations are made to be locale-neutral by specifying
* Locale.ROOT. This causes 'I' to be universally lowercased to 'i'
* regardless of the locale currently in effect.
*/
@Test
public void jsonObjectByLocaleBean() {
MyLocaleBean myLocaleBean = new MyLocaleBean();
/**
* This is just the control case which happens when the locale.ROOT
* lowercasing behavior is the same as the current locale.
*/
Locale.setDefault(new Locale("en"));
JSONObject jsonen = new JSONObject(myLocaleBean);
assertEquals("expected size 2, found: " +jsonen.length(), 2, jsonen.length());
assertEquals("expected jsonen[i] == beanI", "beanI", jsonen.getString("i"));
assertEquals("expected jsonen[id] == beanId", "beanId", jsonen.getString("id"));
/**
* Without the JSON-Java change, these keys would be stored internally as
* starting with the letter, 'ı' (dotless i), since the lowercasing of
* the getI and getId keys would be specific to the Turkish locale.
*/
Locale.setDefault(new Locale("tr"));
JSONObject jsontr = new JSONObject(myLocaleBean);
assertEquals("expected size 2, found: " +jsontr.length(), 2, jsontr.length());
assertEquals("expected jsontr[i] == beanI", "beanI", jsontr.getString("i"));
assertEquals("expected jsontr[id] == beanId", "beanId", jsontr.getString("id"));
}
}

View File

@@ -1,146 +0,0 @@
package org.json.junit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collection;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(value = Parameterized.class)
public class JSONObjectNumberTest {
private final String objectString;
private Integer value = 50;
@Parameters(name = "{index}: {0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"{\"value\":50}", 1},
{"{\"value\":50.0}", 1},
{"{\"value\":5e1}", 1},
{"{\"value\":5E1}", 1},
{"{\"value\":5e1}", 1},
{"{\"value\":\"50\"}", 1},
{"{\"value\":-50}", -1},
{"{\"value\":-50.0}", -1},
{"{\"value\":-5e1}", -1},
{"{\"value\":-5E1}", -1},
{"{\"value\":-5e1}", -1},
{"{\"value\":\"-50\"}", -1}
// JSON does not support octal or hex numbers;
// see https://stackoverflow.com/a/52671839/6323312
// "{value:062}", // octal 50
// "{value:0x32}" // hex 50
});
}
public JSONObjectNumberTest(String objectString, int resultIsNegative) {
this.objectString = objectString;
this.value *= resultIsNegative;
}
private JSONObject object;
@Before
public void setJsonObject() {
object = new JSONObject(objectString);
}
@Test
public void testGetNumber() {
assertEquals(value.intValue(), object.getNumber("value").intValue());
}
@Test
public void testGetBigDecimal() {
assertTrue(BigDecimal.valueOf(value).compareTo(object.getBigDecimal("value")) == 0);
}
@Test
public void testGetBigInteger() {
assertEquals(BigInteger.valueOf(value), object.getBigInteger("value"));
}
@Test
public void testGetFloat() {
assertEquals(value.floatValue(), object.getFloat("value"), 0.0f);
}
@Test
public void testGetDouble() {
assertEquals(value.doubleValue(), object.getDouble("value"), 0.0d);
}
@Test
public void testGetInt() {
assertEquals(value.intValue(), object.getInt("value"));
}
@Test
public void testGetLong() {
assertEquals(value.longValue(), object.getLong("value"));
}
@Test
public void testOptNumber() {
assertEquals(value.intValue(), object.optNumber("value").intValue());
}
@Test
public void testOptBigDecimal() {
assertTrue(BigDecimal.valueOf(value).compareTo(object.optBigDecimal("value", null)) == 0);
}
@Test
public void testOptBigInteger() {
assertEquals(BigInteger.valueOf(value), object.optBigInteger("value", null));
}
@Test
public void testOptFloat() {
assertEquals(value.floatValue(), object.optFloat("value"), 0.0f);
}
@Test
public void testOptFloatObject() {
assertEquals((Float) value.floatValue(), object.optFloatObject("value"), 0.0f);
}
@Test
public void testOptDouble() {
assertEquals(value.doubleValue(), object.optDouble("value"), 0.0d);
}
@Test
public void testOptDoubleObject() {
assertEquals((Double) value.doubleValue(), object.optDoubleObject("value"), 0.0d);
}
@Test
public void testOptInt() {
assertEquals(value.intValue(), object.optInt("value"));
}
@Test
public void testOptIntegerObject() {
assertEquals((Integer) value.intValue(), object.optIntegerObject("value"));
}
@Test
public void testOptLong() {
assertEquals(value.longValue(), object.optLong("value"));
}
@Test
public void testOptLongObject() {
assertEquals((Long) value.longValue(), object.optLongObject("value"));
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,624 +0,0 @@
package org.json.junit;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONParserConfiguration;
import org.json.JSONTokener;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class JSONParserConfigurationTest {
private static final String TEST_SOURCE = "{\"key\": \"value1\", \"key\": \"value2\"}";
@Test(expected = JSONException.class)
public void testThrowException() {
new JSONObject(TEST_SOURCE);
}
@Test
public void testOverwrite() {
JSONObject jsonObject = new JSONObject(TEST_SOURCE,
new JSONParserConfiguration().withOverwriteDuplicateKey(true));
assertEquals("duplicate key should be overwritten", "value2", jsonObject.getString("key"));
}
@Test
public void strictModeIsCloned(){
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true)
.withMaxNestingDepth(12);
assertTrue(jsonParserConfiguration.isStrictMode());
}
@Test
public void maxNestingDepthIsCloned(){
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.<JSONParserConfiguration>withKeepStrings(true)
.withStrictMode(true);
assertTrue(jsonParserConfiguration.isKeepStrings());
}
@Test
public void useNativeNullsIsCloned() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withUseNativeNulls(true)
.withStrictMode(true);
assertTrue(jsonParserConfiguration.isUseNativeNulls());
}
@Test
public void verifyDuplicateKeyThenMaxDepth() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withOverwriteDuplicateKey(true)
.withMaxNestingDepth(42);
assertEquals(42, jsonParserConfiguration.getMaxNestingDepth());
assertTrue(jsonParserConfiguration.isOverwriteDuplicateKey());
}
@Test
public void verifyMaxDepthThenDuplicateKey() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withMaxNestingDepth(42)
.withOverwriteDuplicateKey(true);
assertTrue(jsonParserConfiguration.isOverwriteDuplicateKey());
assertEquals(42, jsonParserConfiguration.getMaxNestingDepth());
}
@Test
public void givenInvalidInput_testStrictModeTrue_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
List<String> strictModeInputTestCases = getNonCompliantJSONArrayList();
// this is a lot easier to debug when things stop working
for (int i = 0; i < strictModeInputTestCases.size(); ++i) {
String testCase = strictModeInputTestCases.get(i);
try {
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
String s = jsonArray.toString();
String msg = "Expected an exception, but got: " + s + " Noncompliant Array index: " + i;
fail(msg);
} catch (Exception e) {
// its all good
}
}
}
@Test
public void givenInvalidInputObjects_testStrictModeTrue_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
List<String> strictModeInputTestCases = getNonCompliantJSONObjectList();
// this is a lot easier to debug when things stop working
for (int i = 0; i < strictModeInputTestCases.size(); ++i) {
String testCase = strictModeInputTestCases.get(i);
try {
JSONObject jsonObject = new JSONObject(testCase, jsonParserConfiguration);
String s = jsonObject.toString();
String msg = "Expected an exception, but got: " + s + " Noncompliant Array index: " + i;
fail(msg);
} catch (Exception e) {
// its all good
}
}
}
@Test
public void givenEmptyArray_testStrictModeTrue_shouldNotThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonArray.toString());
}
@Test
public void givenEmptyObject_testStrictModeTrue_shouldNotThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "{}";
JSONObject jsonObject = new JSONObject(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonObject.toString());
}
@Test
public void givenValidNestedArray_testStrictModeTrue_shouldNotThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[[\"c\"], [10.2], [true, false, true]]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
JSONArray arrayShouldContainStringAt0 = jsonArray.getJSONArray(0);
JSONArray arrayShouldContainNumberAt0 = jsonArray.getJSONArray(1);
JSONArray arrayShouldContainBooleanAt0 = jsonArray.getJSONArray(2);
assertTrue(arrayShouldContainStringAt0.get(0) instanceof String);
assertTrue(arrayShouldContainNumberAt0.get(0) instanceof Number);
assertTrue(arrayShouldContainBooleanAt0.get(0) instanceof Boolean);
}
@Test
public void givenValidNestedObject_testStrictModeTrue_shouldNotThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "{\"a0\":[\"c\"], \"a1\":[10.2], \"a2\":[true, false, true]}";
JSONObject jsonObject = new JSONObject(testCase, jsonParserConfiguration);
JSONArray arrayShouldContainStringAt0 = jsonObject.getJSONArray("a0");
JSONArray arrayShouldContainNumberAt0 = jsonObject.getJSONArray("a1");
JSONArray arrayShouldContainBooleanAt0 = jsonObject.getJSONArray("a2");
assertTrue(arrayShouldContainStringAt0.get(0) instanceof String);
assertTrue(arrayShouldContainNumberAt0.get(0) instanceof Number);
assertTrue(arrayShouldContainBooleanAt0.get(0) instanceof Boolean);
}
@Test
public void givenValidEmptyArrayInsideArray_testStrictModeTrue_shouldNotThrowJsonException(){
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[[]]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonArray.toString());
}
@Test
public void givenValidEmptyArrayInsideObject_testStrictModeTrue_shouldNotThrowJsonException(){
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "{\"a0\":[]}";
JSONObject jsonObject = new JSONObject(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonObject.toString());
}
@Test
public void givenValidEmptyArrayInsideArray_testStrictModeFalse_shouldNotThrowJsonException(){
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCase = "[[]]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonArray.toString());
}
@Test
public void givenValidEmptyArrayInsideObject_testStrictModeFalse_shouldNotThrowJsonException(){
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCase = "{\"a0\":[]}";
JSONObject jsonObject = new JSONObject(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonObject.toString());
}
@Test
public void givenInvalidStringArray_testStrictModeTrue_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[badString]";
JSONException je = assertThrows(JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Value 'badString' is not surrounded by quotes at 10 [character 11 line 1]",
je.getMessage());
}
@Test
public void givenInvalidStringObject_testStrictModeTrue_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "{\"a0\":badString}";
JSONException je = assertThrows(JSONException.class, () -> new JSONObject(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Value 'badString' is not surrounded by quotes at 15 [character 16 line 1]",
je.getMessage());
}
@Test
public void allowNullArrayInStrictMode() {
String expected = "[null]";
JSONArray jsonArray = new JSONArray(expected, new JSONParserConfiguration().withStrictMode(true));
assertEquals(expected, jsonArray.toString());
}
@Test
public void allowNullObjectInStrictMode() {
String expected = "{\"a0\":null}";
JSONObject jsonObject = new JSONObject(expected, new JSONParserConfiguration().withStrictMode(true));
assertEquals(expected, jsonObject.toString());
}
@Test
public void shouldHandleNumericArray() {
String expected = "[10]";
JSONArray jsonArray = new JSONArray(expected, new JSONParserConfiguration().withStrictMode(true));
assertEquals(expected, jsonArray.toString());
}
@Test
public void shouldHandleNumericObject() {
String expected = "{\"a0\":10}";
JSONObject jsonObject = new JSONObject(expected, new JSONParserConfiguration().withStrictMode(true));
assertEquals(expected, jsonObject.toString());
}
@Test
public void givenCompliantJSONArrayFile_testStrictModeTrue_shouldNotThrowAnyException() throws IOException {
try (Stream<String> lines = Files.lines(Paths.get("src/test/resources/compliantJsonArray.json"))) {
String compliantJsonArrayAsString = lines.collect(Collectors.joining());
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
new JSONArray(compliantJsonArrayAsString, jsonParserConfiguration);
}
}
@Test
public void givenCompliantJSONObjectFile_testStrictModeTrue_shouldNotThrowAnyException() throws IOException {
try (Stream<String> lines = Files.lines(Paths.get("src/test/resources/compliantJsonObject.json"))) {
String compliantJsonObjectAsString = lines.collect(Collectors.joining());
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
new JSONObject(compliantJsonObjectAsString, jsonParserConfiguration);
}
}
@Test
public void givenInvalidInputArrays_testStrictModeFalse_shouldNotThrowAnyException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
List<String> strictModeInputTestCases = getNonCompliantJSONArrayList();
// this is a lot easier to debug when things stop working
for (int i = 0; i < strictModeInputTestCases.size(); ++i) {
String testCase = strictModeInputTestCases.get(i);
try {
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
} catch (Exception e) {
System.out.println("Unexpected exception: " + e.getMessage() + " Noncompliant Array index: " + i);
fail(String.format("Noncompliant array index: %d", i));
}
}
}
@Test
public void givenInvalidInputObjects_testStrictModeFalse_shouldNotThrowAnyException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
List<String> strictModeInputTestCases = getNonCompliantJSONObjectList();
// this is a lot easier to debug when things stop working
for (int i = 0; i < strictModeInputTestCases.size(); ++i) {
String testCase = strictModeInputTestCases.get(i);
try {
JSONObject jsonObject = new JSONObject(testCase, jsonParserConfiguration);
} catch (Exception e) {
System.out.println("Unexpected exception: " + e.getMessage() + " Noncompliant Array index: " + i);
fail(String.format("Noncompliant array index: %d", i));
}
}
}
@Test
public void givenInvalidInputArray_testStrictModeTrue_shouldThrowInvalidCharacterErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[1,2];[3,4]";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Unparsed characters found at end of input text at 6 [character 7 line 1]",
je.getMessage());
}
@Test
public void givenInvalidInputObject_testStrictModeTrue_shouldThrowInvalidCharacterErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "{\"a0\":[1,2];\"a1\":[3,4]}";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONObject(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Invalid character ';' found at 12 [character 13 line 1]", je.getMessage());
}
@Test
public void givenInvalidInputArrayWithNumericStrings_testStrictModeTrue_shouldThrowInvalidCharacterErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[\"1\",\"2\"];[3,4]";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Unparsed characters found at end of input text at 10 [character 11 line 1]",
je.getMessage());
}
@Test
public void givenInvalidInputObjectWithNumericStrings_testStrictModeTrue_shouldThrowInvalidCharacterErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "{\"a0\":[\"1\",\"2\"];\"a1\":[3,4]}";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONObject(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Invalid character ';' found at 16 [character 17 line 1]", je.getMessage());
}
@Test
public void givenInvalidInputArray_testStrictModeTrue_shouldThrowValueNotSurroundedByQuotesErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[{\"test\": implied}]";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Value 'implied' is not surrounded by quotes at 17 [character 18 line 1]",
je.getMessage());
}
@Test
public void givenInvalidInputObject_testStrictModeTrue_shouldThrowValueNotSurroundedByQuotesErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "{\"a0\":{\"test\": implied}]}";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONObject(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Value 'implied' is not surrounded by quotes at 22 [character 23 line 1]",
je.getMessage());
}
@Test
public void givenInvalidInputArray_testStrictModeFalse_shouldNotThrowAnyException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCase = "[{\"test\": implied}]";
new JSONArray(testCase, jsonParserConfiguration);
}
@Test
public void givenInvalidInputObject_testStrictModeFalse_shouldNotThrowAnyException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCase = "{\"a0\":{\"test\": implied}}";
new JSONObject(testCase, jsonParserConfiguration);
}
@Test
public void givenNonCompliantQuotesArray_testStrictModeTrue_shouldThrowJsonExceptionWithConcreteErrorDescription() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCaseOne = "[\"abc', \"test\"]";
String testCaseTwo = "['abc\", \"test\"]";
String testCaseThree = "['abc']";
String testCaseFour = "[{'testField': \"testValue\"}]";
JSONException jeOne = assertThrows(JSONException.class,
() -> new JSONArray(testCaseOne, jsonParserConfiguration));
JSONException jeTwo = assertThrows(JSONException.class,
() -> new JSONArray(testCaseTwo, jsonParserConfiguration));
JSONException jeThree = assertThrows(JSONException.class,
() -> new JSONArray(testCaseThree, jsonParserConfiguration));
JSONException jeFour = assertThrows(JSONException.class,
() -> new JSONArray(testCaseFour, jsonParserConfiguration));
assertEquals(
"Expected a ',' or ']' at 10 [character 11 line 1]",
jeOne.getMessage());
assertEquals(
"Strict mode error: Single quoted strings are not allowed at 2 [character 3 line 1]",
jeTwo.getMessage());
assertEquals(
"Strict mode error: Single quoted strings are not allowed at 2 [character 3 line 1]",
jeThree.getMessage());
assertEquals(
"Strict mode error: Single quoted strings are not allowed at 3 [character 4 line 1]",
jeFour.getMessage());
}
@Test
public void givenNonCompliantQuotesObject_testStrictModeTrue_shouldThrowJsonExceptionWithConcreteErrorDescription() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCaseOne = "{\"abc': \"test\"}";
String testCaseTwo = "{'abc\": \"test\"}";
String testCaseThree = "{\"a\":'abc'}";
String testCaseFour = "{'testField': \"testValue\"}";
JSONException jeOne = assertThrows(JSONException.class,
() -> new JSONObject(testCaseOne, jsonParserConfiguration));
JSONException jeTwo = assertThrows(JSONException.class,
() -> new JSONObject(testCaseTwo, jsonParserConfiguration));
JSONException jeThree = assertThrows(JSONException.class,
() -> new JSONObject(testCaseThree, jsonParserConfiguration));
JSONException jeFour = assertThrows(JSONException.class,
() -> new JSONObject(testCaseFour, jsonParserConfiguration));
assertEquals(
"Expected a ':' after a key at 10 [character 11 line 1]",
jeOne.getMessage());
assertEquals(
"Strict mode error: Single quoted strings are not allowed at 2 [character 3 line 1]",
jeTwo.getMessage());
assertEquals(
"Strict mode error: Single quoted strings are not allowed at 6 [character 7 line 1]",
jeThree.getMessage());
assertEquals(
"Strict mode error: Single quoted strings are not allowed at 2 [character 3 line 1]",
jeFour.getMessage());
}
@Test
public void givenUnbalancedQuotesArray_testStrictModeFalse_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCaseOne = "[\"abc', \"test\"]";
String testCaseTwo = "['abc\", \"test\"]";
JSONException jeOne = assertThrows(JSONException.class,
() -> new JSONArray(testCaseOne, jsonParserConfiguration));
JSONException jeTwo = assertThrows(JSONException.class,
() -> new JSONArray(testCaseTwo, jsonParserConfiguration));
assertEquals("Expected a ',' or ']' at 10 [character 11 line 1]", jeOne.getMessage());
assertEquals("Unterminated string. Character with int code 0 is not allowed within a quoted string. at 15 [character 16 line 1]", jeTwo.getMessage());
}
@Test
public void givenUnbalancedQuotesObject_testStrictModeFalse_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCaseOne = "{\"abc': \"test\"}";
String testCaseTwo = "{'abc\": \"test\"}";
JSONException jeOne = assertThrows(JSONException.class,
() -> new JSONObject(testCaseOne, jsonParserConfiguration));
JSONException jeTwo = assertThrows(JSONException.class,
() -> new JSONObject(testCaseTwo, jsonParserConfiguration));
assertEquals("Expected a ':' after a key at 10 [character 11 line 1]", jeOne.getMessage());
assertEquals("Unterminated string. Character with int code 0 is not allowed within a quoted string. at 15 [character 16 line 1]", jeTwo.getMessage());
}
@Test
public void givenInvalidInputArray_testStrictModeTrue_shouldThrowKeyNotSurroundedByQuotesErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[{test: implied}]";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Value 'test' is not surrounded by quotes at 6 [character 7 line 1]",
je.getMessage());
}
@Test
public void givenInvalidInputObject_testStrictModeTrue_shouldThrowKeyNotSurroundedByQuotesErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "{test: implied}";
JSONException je = assertThrows("expected non-compliant json but got instead: " + testCase,
JSONException.class, () -> new JSONObject(testCase, jsonParserConfiguration));
assertEquals("Strict mode error: Value 'test' is not surrounded by quotes at 5 [character 6 line 1]",
je.getMessage());
}
@Test
public void givenInvalidInputObject_testStrictModeTrue_JSONObjectUsingJSONTokener_shouldThrowJSONException() {
JSONException exception = assertThrows(JSONException.class, () -> {
new JSONObject(new JSONTokener("{\"key\":\"value\"} invalid trailing text"), new JSONParserConfiguration().withStrictMode(true));
});
assertEquals("Strict mode error: Unparsed characters found at end of input text at 17 [character 18 line 1]", exception.getMessage());
}
@Test
public void givenInvalidInputObject_testStrictModeTrue_JSONObjectUsingString_shouldThrowJSONException() {
JSONException exception = assertThrows(JSONException.class, () -> {
new JSONObject("{\"key\":\"value\"} invalid trailing text", new JSONParserConfiguration().withStrictMode(true));
});
assertEquals("Strict mode error: Unparsed characters found at end of input text at 17 [character 18 line 1]", exception.getMessage());
}
@Test
public void givenInvalidInputObject_testStrictModeTrue_JSONArrayUsingJSONTokener_shouldThrowJSONException() {
JSONException exception = assertThrows(JSONException.class, () -> {
new JSONArray(new JSONTokener("[\"value\"] invalid trailing text"), new JSONParserConfiguration().withStrictMode(true));
});
assertEquals("Strict mode error: Unparsed characters found at end of input text at 11 [character 12 line 1]", exception.getMessage());
}
@Test
public void givenInvalidInputObject_testStrictModeTrue_JSONArrayUsingString_shouldThrowJSONException() {
JSONException exception = assertThrows(JSONException.class, () -> {
new JSONArray("[\"value\"] invalid trailing text", new JSONParserConfiguration().withStrictMode(true));
});
assertEquals("Strict mode error: Unparsed characters found at end of input text at 11 [character 12 line 1]", exception.getMessage());
}
/**
* This method contains short but focused use-case samples and is exclusively used to test strictMode unit tests in
* this class.
*
* @return List with JSON strings.
*/
private List<String> getNonCompliantJSONArrayList() {
return Arrays.asList(
"[1],",
"[1,]",
"[,]",
"[,,]",
"[[1],\"sa\",[2]]a",
"[1],\"dsa\": \"test\"",
"[[a]]",
"[]asdf",
"[]]",
"[]}",
"[][",
"[]{",
"[],",
"[]:",
"[],[",
"[],{",
"[1,2];[3,4]",
"[test]",
"[{'testSingleQuote': 'testSingleQuote'}]",
"[1, 2,3]:[4,5]",
"[{test: implied}]",
"[{\"test\": implied}]",
"[{\"number\":\"7990154836330\",\"color\":'c'},{\"number\":8784148854580,\"color\":RosyBrown},{\"number\":\"5875770107113\",\"color\":\"DarkSeaGreen\"}]",
"[{test: \"implied\"}]");
}
/**
* This method contains short but focused use-case samples and is exclusively used to test strictMode unit tests in
* this class.
*
* @return List with JSON strings.
*/
private List<String> getNonCompliantJSONObjectList() {
return Arrays.asList(
"{\"a\":1},",
"{\"a\":1,}",
"{\"a0\":[1],\"a1\":\"sa\",\"a2\":[2]}a",
"{\"a\":1},\"dsa\": \"test\"",
"{\"a\":[a]}",
"{}asdf",
"{}}",
"{}]",
"{}{",
"{}[",
"{},",
"{}:",
"{},{",
"{},[",
"{\"a0\":[1,2];\"a1\":[3,4]}",
"{\"a\":test}",
"{a:{'testSingleQuote': 'testSingleQuote'}}",
"{\"a0\":1, \"a1\":2,\"a2\":3}:{\"a3\":4,\"a4\":5}",
"{\"a\":{test: implied}}",
"{a:{\"test\": implied}}",
"{a:[{\"number\":\"7990154836330\",\"color\":'c'},{\"number\":8784148854580,\"color\":RosyBrown},{\"number\":\"5875770107113\",\"color\":\"DarkSeaGreen\"}]}",
"{a:{test: \"implied\"}}"
);
}
}

View File

@@ -1,398 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.InputStream;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONPointer;
import org.json.JSONPointerException;
import org.json.JSONTokener;
import org.junit.Test;
public class JSONPointerTest {
private static final JSONObject document;
private static final String EXPECTED_COMPLETE_DOCUMENT = "{\"\":0,\" \":7,\"g|h\":4,\"c%d\":2,\"k\\\"l\":6,\"a/b\":1,\"i\\\\j\":5," +
"\"obj\":{\"\":{\"\":\"empty key of an object with an empty key\",\"subKey\":\"Some other value\"}," +
"\"other~key\":{\"another/key\":[\"val\"]},\"key\":\"value\"},\"foo\":[\"bar\",\"baz\"],\"e^f\":3," +
"\"m~n\":8}";
static {
@SuppressWarnings("resource")
InputStream resourceAsStream = JSONPointerTest.class.getClassLoader().getResourceAsStream("jsonpointer-testdoc.json");
if(resourceAsStream == null) {
throw new ExceptionInInitializerError("Unable to locate test file. Please check your development environment configuration");
}
document = new JSONObject(new JSONTokener(resourceAsStream));
}
private Object query(String pointer) {
return new JSONPointer(pointer).queryFrom(document);
}
@Test
public void emptyPointer() {
assertTrue(new JSONObject(EXPECTED_COMPLETE_DOCUMENT).similar(query("")));
}
@SuppressWarnings("unused")
@Test(expected = NullPointerException.class)
public void nullPointer() {
new JSONPointer((String) null);
}
@Test
public void objectPropertyQuery() {
assertEquals("[\"bar\",\"baz\"]", query("/foo").toString());
}
@Test
public void arrayIndexQuery() {
assertEquals("bar", query("/foo/0"));
}
@Test(expected = JSONPointerException.class)
public void stringPropOfArrayFailure() {
query("/foo/bar");
}
@Test
public void queryByEmptyKey() {
assertEquals(0, query("/"));
}
@Test
public void queryByEmptyKeySubObject() {
JSONObject json = new JSONObject("{\"\":\"empty key of an object with an empty key\",\"subKey\":\"Some" +
" other value\"}");
JSONObject obj = (JSONObject) query("/obj/");
assertTrue(json.similar(obj));
}
@Test
public void queryByEmptyKeySubObjectSubOject() {
assertEquals("empty key of an object with an empty key", query("/obj//"));
}
@Test
public void queryByEmptyKeySubObjectValue() {
assertEquals("Some other value", query("/obj//subKey"));
}
@Test
public void slashEscaping() {
assertEquals(1, query("/a~1b"));
}
@Test
public void tildeEscaping() {
assertEquals(8, query("/m~0n"));
}
/**
* We pass backslashes as-is
*
* @see <a href="https://tools.ietf.org/html/rfc6901#section-3">rfc6901 section 3</a>
*/
@Test
public void backslashHandling() {
assertEquals(5, query("/i\\j"));
}
/**
* We pass quotations as-is
*
* @see <a href="https://tools.ietf.org/html/rfc6901#section-3">rfc6901 section 3</a>
*/
@Test
public void quotationHandling() {
assertEquals(6, query("/k\"l"));
}
@Test
public void whitespaceKey() {
assertEquals(7, query("/ "));
}
@Test
public void uriFragmentNotation() {
assertEquals("[\"bar\",\"baz\"]", query("#/foo").toString());
}
@Test
public void uriFragmentNotationRoot() {
assertTrue(new JSONObject(EXPECTED_COMPLETE_DOCUMENT).similar(query("#")));
}
@Test
public void uriFragmentPercentHandling() {
assertEquals(2, query("#/c%25d"));
assertEquals(3, query("#/e%5Ef"));
assertEquals(4, query("#/g%7Ch"));
assertEquals(8, query("#/m~0n"));
}
@SuppressWarnings("unused")
@Test(expected = IllegalArgumentException.class)
public void syntaxError() {
new JSONPointer("key");
}
@Test(expected = JSONPointerException.class)
public void arrayIndexFailure() {
query("/foo/2");
}
@Test(expected = JSONPointerException.class)
public void primitiveFailure() {
query("/obj/key/failure");
}
@Test
public void builderTest() {
JSONPointer pointer = JSONPointer.builder()
.append("obj")
.append("other~key").append("another/key")
.append(0)
.build();
assertEquals("val", pointer.queryFrom(document));
}
@Test(expected = NullPointerException.class)
public void nullToken() {
JSONPointer.builder().append(null);
}
@Test
public void toStringEscaping() {
JSONPointer pointer = JSONPointer.builder()
.append("obj")
.append("other~key").append("another/key")
.append("\"")
.append(0)
.build();
assertEquals("/obj/other~0key/another~1key/\"/0", pointer.toString());
}
@Test
public void emptyPointerToString() {
assertEquals("", new JSONPointer("").toString());
}
@Test
public void toURIFragment() {
assertEquals("#/c%25d", new JSONPointer("/c%d").toURIFragment());
assertEquals("#/e%5Ef", new JSONPointer("/e^f").toURIFragment());
assertEquals("#/g%7Ch", new JSONPointer("/g|h").toURIFragment());
assertEquals("#/m%7En", new JSONPointer("/m~n").toURIFragment());
}
@Test
public void tokenListIsCopiedInConstructor() {
JSONPointer.Builder b = JSONPointer.builder().append("key1");
JSONPointer jp1 = b.build();
b.append("key2");
JSONPointer jp2 = b.build();
if(jp1.toString().equals(jp2.toString())) {
fail("Oops, my pointers are sharing a backing array");
}
}
/**
* Coverage for JSONObject query(String)
*/
@Test
public void queryFromJSONObject() {
String str = "{"+
"\"stringKey\":\"hello world!\","+
"\"arrayKey\":[0,1,2],"+
"\"objectKey\": {"+
"\"a\":\"aVal\","+
"\"b\":\"bVal\""+
"}"+
"}";
JSONObject jsonObject = new JSONObject(str);
Object obj = jsonObject.query("/stringKey");
assertTrue("Expected 'hello world!'", "hello world!".equals(obj));
obj = jsonObject.query("/arrayKey/1");
assertTrue("Expected 1", Integer.valueOf(1).equals(obj));
obj = jsonObject.query("/objectKey/b");
assertTrue("Expected bVal", "bVal".equals(obj));
try {
obj = jsonObject.query("/a/b/c");
assertTrue("Expected JSONPointerException", false);
} catch (JSONPointerException e) {
assertTrue("Expected bad key/value exception",
"value [null] is not an array or object therefore its key b cannot be resolved".
equals(e.getMessage()));
}
}
/**
* Coverage for JSONObject query(JSONPointer)
*/
@Test
public void queryFromJSONObjectUsingPointer() {
String str = "{"+
"\"stringKey\":\"hello world!\","+
"\"arrayKey\":[0,1,2],"+
"\"objectKey\": {"+
"\"a\":\"aVal\","+
"\"b\":\"bVal\""+
"}"+
"}";
JSONObject jsonObject = new JSONObject(str);
Object obj = jsonObject.query(new JSONPointer("/stringKey"));
assertTrue("Expected 'hello world!'", "hello world!".equals(obj));
obj = jsonObject.query(new JSONPointer("/arrayKey/1"));
assertTrue("Expected 1", Integer.valueOf(1).equals(obj));
obj = jsonObject.query(new JSONPointer("/objectKey/b"));
assertTrue("Expected bVal", "bVal".equals(obj));
try {
obj = jsonObject.query(new JSONPointer("/a/b/c"));
assertTrue("Expected JSONPointerException", false);
} catch (JSONPointerException e) {
assertTrue("Expected bad key/value exception",
"value [null] is not an array or object therefore its key b cannot be resolved".
equals(e.getMessage()));
}
}
/**
* Coverage for JSONObject optQuery(JSONPointer)
*/
@Test
public void optQueryFromJSONObjectUsingPointer() {
String str = "{"+
"\"stringKey\":\"hello world!\","+
"\"arrayKey\":[0,1,2],"+
"\"objectKey\": {"+
"\"a\":\"aVal\","+
"\"b\":\"bVal\""+
"}"+
"}";
JSONObject jsonObject = new JSONObject(str);
Object obj = jsonObject.optQuery(new JSONPointer("/stringKey"));
assertTrue("Expected 'hello world!'", "hello world!".equals(obj));
obj = jsonObject.optQuery(new JSONPointer("/arrayKey/1"));
assertTrue("Expected 1", Integer.valueOf(1).equals(obj));
obj = jsonObject.optQuery(new JSONPointer("/objectKey/b"));
assertTrue("Expected bVal", "bVal".equals(obj));
obj = jsonObject.optQuery(new JSONPointer("/a/b/c"));
assertTrue("Expected null", obj == null);
}
/**
* Coverage for JSONArray query(String)
*/
@Test
public void queryFromJSONArray() {
String str = "["+
"\"hello world!\","+
"[0,1,2],"+
"{"+
"\"a\":\"aVal\","+
"\"b\":\"bVal\""+
"}"+
"]";
JSONArray jsonArray = new JSONArray(str);
Object obj = jsonArray.query("/0");
assertTrue("Expected 'hello world!'", "hello world!".equals(obj));
obj = jsonArray.query("/1/1");
assertTrue("Expected 1", Integer.valueOf(1).equals(obj));
obj = jsonArray.query("/2/b");
assertTrue("Expected bVal", "bVal".equals(obj));
try {
obj = jsonArray.query("/a/b/c");
assertTrue("Expected JSONPointerException", false);
} catch (JSONPointerException e) {
assertTrue("Expected bad index exception",
"a is not an array index".equals(e.getMessage()));
}
}
/**
* Coverage for JSONArray query(JSONPointer)
*/
@Test
public void queryFromJSONArrayUsingPointer() {
String str = "["+
"\"hello world!\","+
"[0,1,2],"+
"{"+
"\"a\":\"aVal\","+
"\"b\":\"bVal\""+
"}"+
"]";
JSONArray jsonArray = new JSONArray(str);
Object obj = jsonArray.query(new JSONPointer("/0"));
assertTrue("Expected 'hello world!'", "hello world!".equals(obj));
obj = jsonArray.query(new JSONPointer("/1/1"));
assertTrue("Expected 1", Integer.valueOf(1).equals(obj));
obj = jsonArray.query(new JSONPointer("/2/b"));
assertTrue("Expected bVal", "bVal".equals(obj));
try {
obj = jsonArray.query(new JSONPointer("/a/b/c"));
assertTrue("Expected JSONPointerException", false);
} catch (JSONPointerException e) {
assertTrue("Expected bad index exception",
"a is not an array index".equals(e.getMessage()));
}
}
/**
* Coverage for JSONArray optQuery(JSONPointer)
*/
@Test
public void optQueryFromJSONArrayUsingPointer() {
String str = "["+
"\"hello world!\","+
"[0,1,2],"+
"{"+
"\"a\":\"aVal\","+
"\"b\":\"bVal\""+
"}"+
"]";
JSONArray jsonArray = new JSONArray(str);
Object obj = jsonArray.optQuery(new JSONPointer("/0"));
assertTrue("Expected 'hello world!'", "hello world!".equals(obj));
obj = jsonArray.optQuery(new JSONPointer("/1/1"));
assertTrue("Expected 1", Integer.valueOf(1).equals(obj));
obj = jsonArray.optQuery(new JSONPointer("/2/b"));
assertTrue("Expected bVal", "bVal".equals(obj));
obj = jsonArray.optQuery(new JSONPointer("/a/b/c"));
assertTrue("Expected null", obj == null);
}
/**
* When creating a jsonObject we need to parse escaped characters "\\\\"
* --> it's the string representation of "\\", so when query'ing via the JSONPointer
* we DON'T escape them
*
*/
@Test
public void queryFromJSONObjectUsingPointer0() {
String str = "{"+
"\"string\\\\\\\\Key\":\"hello world!\","+
"\"\\\\\":\"slash test\"" +
"}";
JSONObject jsonObject = new JSONObject(str);
//Summary of issue: When a KEY in the jsonObject is "\\\\" --> it's held
// as "\\" which means when querying, we need to use "\\"
Object twoBackslahObj = jsonObject.optQuery(new JSONPointer("/\\"));
assertEquals("slash test", twoBackslahObj);
Object fourBackslashObj = jsonObject.optQuery(new JSONPointer("/string\\\\Key"));
assertEquals("hello world!", fourBackslashObj);
}
}

View File

@@ -1,401 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import java.io.StringWriter;
import java.util.*;
import org.json.*;
import org.junit.Test;
/**
* Tests for JSONString implementations, and the difference between
* {@link JSONObject#valueToString} and {@link JSONObject#writeValue}.
*/
public class JSONStringTest {
/**
* This tests the JSONObject.writeValue() method. We can't test directly
* due to it being a package-protected method. Instead, we can call
* JSONArray.write(), which delegates the writing of each entry to
* writeValue().
*/
@Test
public void writeValues() throws Exception {
JSONArray jsonArray = new JSONArray();
jsonArray.put((Object)null);
StringWriter writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[null]".equals(output));
jsonArray = new JSONArray();
jsonArray.put(JSONObject.NULL);
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[null]".equals(output));
jsonArray = new JSONArray();
jsonArray.put(new JSONObject());
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[{}]".equals(output));
jsonArray = new JSONArray();
jsonArray.put(new JSONArray());
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[[]]".equals(output));
jsonArray = new JSONArray();
Map<?,?> singleMap = Collections.singletonMap("key1", "value1");
jsonArray.put((Object)singleMap);
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[{\"key1\":\"value1\"}]".equals(output));
jsonArray = new JSONArray();
List<?> singleList = Collections.singletonList("entry1");
jsonArray.put((Object)singleList);
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[[\"entry1\"]]".equals(output));
jsonArray = new JSONArray();
int[] intArray = new int[] { 1, 2, 3 };
jsonArray.put(intArray);
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[[1,2,3]]".equals(output));
jsonArray = new JSONArray();
jsonArray.put(24);
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[24]".equals(output));
jsonArray = new JSONArray();
jsonArray.put("string value");
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[\"string value\"]".equals(output));
jsonArray = new JSONArray();
jsonArray.put(true);
} finally {
writer.close();
}
writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[true]".equals(output));
} finally {
writer.close();
}
}
/**
* This tests the JSONObject.valueToString() method. These should be
* identical to the values above, except for the enclosing [ and ].
*/
@SuppressWarnings("boxing")
@Test
public void valuesToString() throws Exception {
String output = JSONObject.valueToString(null);
assertTrue("String values should be equal", "null".equals(output));
output = JSONObject.valueToString(JSONObject.NULL);
assertTrue("String values should be equal", "null".equals(output));
output = JSONObject.valueToString(new JSONObject());
assertTrue("String values should be equal", "{}".equals(output));
output = JSONObject.valueToString(new JSONArray());
assertTrue("String values should be equal", "[]".equals(output));
Map<?,?> singleMap = Collections.singletonMap("key1", "value1");
output = JSONObject.valueToString(singleMap);
assertTrue("String values should be equal", "{\"key1\":\"value1\"}".equals(output));
List<?> singleList = Collections.singletonList("entry1");
output = JSONObject.valueToString(singleList);
assertTrue("String values should be equal", "[\"entry1\"]".equals(output));
int[] intArray = new int[] { 1, 2, 3 };
output = JSONObject.valueToString(intArray);
assertTrue("String values should be equal", "[1,2,3]".equals(output));
output = JSONObject.valueToString(24);
assertTrue("String values should be equal", "24".equals(output));
output = JSONObject.valueToString("string value");
assertTrue("String values should be equal", "\"string value\"".equals(output));
output = JSONObject.valueToString(true);
assertTrue("String values should be equal", "true".equals(output));
}
/**
* Test what happens when toJSONString() returns a well-formed JSON value.
* This is the usual case.
*/
@Test
public void testJSONStringValue() throws Exception {
JSONStringValue jsonString = new JSONStringValue();
JSONArray jsonArray = new JSONArray();
jsonArray.put(jsonString);
StringWriter writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[\"the JSON string value\"]".equals(output));
output = JSONObject.valueToString(jsonString);
assertTrue("String values should be equal", "\"the JSON string value\"".equals(output));
} finally {
writer.close();
}
}
/**
* Test what happens when toJSONString() returns null. In one case,
* use the object's toString() method. In the other, throw a JSONException.
*/
@Test
public void testJSONNullStringValue() throws Exception {
JSONNullStringValue jsonString = new JSONNullStringValue();
JSONArray jsonArray = new JSONArray();
jsonArray.put(jsonString);
StringWriter writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[\"the toString value\"]".equals(output));
// The only different between writeValue() and valueToString():
// in this case, valueToString throws a JSONException
try {
output = JSONObject.valueToString(jsonString);
fail("Expected an exception, got a String value");
} catch (Exception e) {
assertTrue("Expected JSONException", e instanceof JSONException);
assertTrue("Exception message does not match", "Bad value from toJSONString: null".equals(e.getMessage()));
}
} finally {
writer.close();
}
}
/**
* Test what happens when toJSONString() returns an exception. In both
* cases, a JSONException is thrown, with the cause and message set from
* the original exception.
*/
@Test
public void testJSONStringExceptionValue() {
JSONStringExceptionValue jsonString = new JSONStringExceptionValue();
JSONArray jsonArray = new JSONArray();
jsonArray.put(jsonString);
StringWriter writer = new StringWriter();
try {
jsonArray.write(writer).toString();
fail("Expected an exception, got a String value");
} catch (JSONException e) {
assertEquals("Unable to write JSONArray value at index: 0", e.getMessage());
} catch(Exception e) {
fail("Expected JSONException");
} finally {
try {
writer.close();
} catch (Exception e){}
}
try {
JSONObject.valueToString(jsonString);
fail("Expected an exception, got a String value");
} catch (JSONException e) {
assertTrue("Exception message does not match", "the exception value".equals(e.getMessage()));
} catch(Exception e) {
fail("Expected JSONException");
}
}
/**
* Test what happens when a Java object's toString() returns a String value.
* This is the usual case.
*/
@Test
public void testStringValue() throws Exception {
StringValue nonJsonString = new StringValue();
JSONArray jsonArray = new JSONArray();
jsonArray.put(nonJsonString);
StringWriter writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[\"the toString value for StringValue\"]".equals(output));
output = JSONObject.valueToString(nonJsonString);
assertTrue("String values should be equal", "\"the toString value for StringValue\"".equals(output));
} finally {
writer.close();
}
}
/**
* Test what happens when a Java object's toString() returns null.
* Defaults to empty string.
*/
@Test
public void testNullStringValue() throws Exception {
NullStringValue nonJsonString = new NullStringValue();
JSONArray jsonArray = new JSONArray();
jsonArray.put(nonJsonString);
StringWriter writer = new StringWriter();
try {
String output = jsonArray.write(writer).toString();
assertTrue("String values should be equal", "[\"\"]".equals(output));
output = JSONObject.valueToString(nonJsonString);
assertTrue("String values should be equal", "\"\"".equals(output));
} finally {
writer.close();
}
}
@Test
public void testEnumJSONString() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("key", MyEnum.MY_ENUM);
assertEquals("{\"key\":\"myJsonString\"}", jsonObject.toString());
}
private enum MyEnum implements JSONString {
MY_ENUM;
@Override
public String toJSONString() {
return "\"myJsonString\"";
}
}
/**
* A JSONString that returns a valid JSON string value.
*/
private static final class JSONStringValue implements JSONString {
@Override
public String toJSONString() {
return "\"the JSON string value\"";
}
@Override
public String toString() {
return "the toString value for JSONStringValue";
}
}
/**
* A JSONString that returns null when calling toJSONString().
*/
private static final class JSONNullStringValue implements JSONString {
@Override
public String toJSONString() {
return null;
}
@Override
public String toString() {
return "the toString value";
}
}
/**
* A JSONString that throw an exception when calling toJSONString().
*/
private static final class JSONStringExceptionValue implements JSONString {
@Override
public String toJSONString() {
throw new IllegalStateException("the exception value");
}
@Override
public String toString() {
return "the toString value for JSONStringExceptionValue";
}
}
public static final class StringValue {
@Override
public String toString() {
return "the toString value for StringValue";
}
}
public static final class NullStringValue {
@Override
public String toString() {
return null;
}
}
}

View File

@@ -1,357 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import java.math.BigDecimal;
import java.util.*;
import org.json.*;
import org.junit.Test;
import com.jayway.jsonpath.*;
/**
* Tests for JSON-Java JSONStringer and JSONWriter.
*/
public class JSONStringerTest {
/**
* Object with a null key.
* Expects a JSONException.
*/
@Test
public void nullKeyException() {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.object();
try {
jsonStringer.key(null);
assertTrue("Expected an exception", false);
} catch (JSONException e) {
assertTrue("Expected an exception message",
"Null key.".
equals(e.getMessage()));
}
}
/**
* Add a key with no object.
* Expects a JSONException.
*/
@Test
public void outOfSequenceException() {
JSONStringer jsonStringer = new JSONStringer();
try {
jsonStringer.key("hi");
assertTrue("Expected an exception", false);
} catch (JSONException e) {
assertTrue("Expected an exception message",
"Misplaced key.".
equals(e.getMessage()));
}
}
/**
* Missplace an array.
* Expects a JSONException
*/
@Test
public void missplacedArrayException() {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.object().endObject();
try {
jsonStringer.array();
assertTrue("Expected an exception", false);
} catch (JSONException e) {
assertTrue("Expected an exception message",
"Misplaced array.".
equals(e.getMessage()));
}
}
/**
* Missplace an endErray.
* Expects a JSONException
*/
@Test
public void missplacedEndArrayException() {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.object();
try {
jsonStringer.endArray();
assertTrue("Expected an exception", false);
} catch (JSONException e) {
assertTrue("Expected an exception message",
"Misplaced endArray.".
equals(e.getMessage()));
}
}
/**
* Missplace an endObject.
* Expects a JSONException
*/
@Test
public void missplacedEndObjectException() {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.array();
try {
jsonStringer.endObject();
assertTrue("Expected an exception", false);
} catch (JSONException e) {
assertTrue("Expected an exception message",
"Misplaced endObject.".
equals(e.getMessage()));
}
}
/**
* Missplace an object.
* Expects a JSONException.
*/
@Test
public void missplacedObjectException() {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.object().endObject();
try {
jsonStringer.object();
assertTrue("Expected an exception", false);
} catch (JSONException e) {
assertTrue("Expected an exception message",
"Misplaced object.".
equals(e.getMessage()));
}
}
/**
* Exceeds implementation max nesting depth.
* Expects a JSONException
*/
@Test
public void exceedNestDepthException() {
try {
JSONStringer s = new JSONStringer();
s.object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object();
s.key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object().
key("k").object().key("k").object().key("k").object().key("k").object().key("k").object();
fail("Expected an exception message");
} catch (JSONException e) {
assertTrue("Expected an exception message",
"Nesting too deep.".
equals(e.getMessage()));
}
}
/**
* Build a JSON doc using JSONString API calls,
* then convert to JSONObject
*/
@Test
public void simpleObjectString() {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.object();
jsonStringer.key("trueValue").value(true);
jsonStringer.key("falseValue").value(false);
jsonStringer.key("nullValue").value(null);
jsonStringer.key("stringValue").value("hello world!");
jsonStringer.key("complexStringValue").value("h\be\tllo w\u1234orld!");
jsonStringer.key("intValue").value(42);
jsonStringer.key("doubleValue").value(-23.45e67);
jsonStringer.endObject();
String str = jsonStringer.toString();
JSONObject jsonObject = new JSONObject(str);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 7 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 7);
assertTrue("expected true", Boolean.TRUE.equals(jsonObject.query("/trueValue")));
assertTrue("expected false", Boolean.FALSE.equals(jsonObject.query("/falseValue")));
assertTrue("expected null", JSONObject.NULL.equals(jsonObject.query("/nullValue")));
assertTrue("expected hello world!", "hello world!".equals(jsonObject.query("/stringValue")));
assertTrue("expected h\be\tllo w\u1234orld!", "h\be\tllo w\u1234orld!".equals(jsonObject.query("/complexStringValue")));
assertTrue("expected 42", Integer.valueOf(42).equals(jsonObject.query("/intValue")));
assertTrue("expected -23.45e67", BigDecimal.valueOf(-23.45e67).equals(jsonObject.query("/doubleValue")));
}
/**
* Build a JSON doc using JSONString API calls,
* then convert to JSONArray
*/
@Test
public void simpleArrayString() {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.array();
jsonStringer.value(true);
jsonStringer.value(false);
jsonStringer.value(null);
jsonStringer.value("hello world!");
jsonStringer.value(42);
jsonStringer.value(-23.45e67);
jsonStringer.endArray();
String str = jsonStringer.toString();
JSONArray jsonArray = new JSONArray(str);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonArray.toString());
assertTrue("expected 6 top level items", ((List<?>)(JsonPath.read(doc, "$"))).size() == 6);
assertTrue("expected true", Boolean.TRUE.equals(jsonArray.query("/0")));
assertTrue("expected false", Boolean.FALSE.equals(jsonArray.query("/1")));
assertTrue("expected null", JSONObject.NULL.equals(jsonArray.query("/2")));
assertTrue("expected hello world!", "hello world!".equals(jsonArray.query("/3")));
assertTrue("expected 42", Integer.valueOf(42).equals(jsonArray.query("/4")));
assertTrue("expected -23.45e67", BigDecimal.valueOf(-23.45e67).equals(jsonArray.query("/5")));
}
/**
* Build a nested JSON doc using JSONString API calls, then convert to
* JSONObject. Will create a long cascade of output by reusing the
* returned values..
*/
@Test
public void complexObjectString() {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.object().
key("trueValue").value(true).
key("falseValue").value(false).
key("nullValue").value(null).
key("stringValue").value("hello world!").
key("object2").object().
key("k1").value("v1").
key("k2").value("v2").
key("k3").value("v3").
key("array1").array().
value(1).
value(2).
object().
key("k4").value("v4").
key("k5").value("v5").
key("k6").value("v6").
key("array2").array().
value(5).
value(6).
value(7).
value(8).
endArray().
endObject().
value(3).
value(4).
endArray().
endObject().
key("complexStringValue").value("h\be\tllo w\u1234orld!").
key("intValue").value(42).
key("doubleValue").value(-23.45e67).
endObject();
String str = jsonStringer.toString();
JSONObject jsonObject = new JSONObject(str);
// validate JSON content
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(jsonObject.toString());
assertTrue("expected 8 top level items", ((Map<?,?>)(JsonPath.read(doc, "$"))).size() == 8);
assertTrue("expected 4 object2 items", ((Map<?,?>)(JsonPath.read(doc, "$.object2"))).size() == 4);
assertTrue("expected 5 array1 items", ((List<?>)(JsonPath.read(doc, "$.object2.array1"))).size() == 5);
assertTrue("expected 4 array[2] items", ((Map<?,?>)(JsonPath.read(doc, "$.object2.array1[2]"))).size() == 4);
assertTrue("expected 4 array1[2].array2 items", ((List<?>)(JsonPath.read(doc, "$.object2.array1[2].array2"))).size() == 4);
assertTrue("expected true", Boolean.TRUE.equals(jsonObject.query("/trueValue")));
assertTrue("expected false", Boolean.FALSE.equals(jsonObject.query("/falseValue")));
assertTrue("expected null", JSONObject.NULL.equals(jsonObject.query("/nullValue")));
assertTrue("expected hello world!", "hello world!".equals(jsonObject.query("/stringValue")));
assertTrue("expected 42", Integer.valueOf(42).equals(jsonObject.query("/intValue")));
assertTrue("expected -23.45e67", BigDecimal.valueOf(-23.45e67).equals(jsonObject.query("/doubleValue")));
assertTrue("expected h\be\tllo w\u1234orld!", "h\be\tllo w\u1234orld!".equals(jsonObject.query("/complexStringValue")));
assertTrue("expected v1", "v1".equals(jsonObject.query("/object2/k1")));
assertTrue("expected v2", "v2".equals(jsonObject.query("/object2/k2")));
assertTrue("expected v3", "v3".equals(jsonObject.query("/object2/k3")));
assertTrue("expected 1", Integer.valueOf(1).equals(jsonObject.query("/object2/array1/0")));
assertTrue("expected 2", Integer.valueOf(2).equals(jsonObject.query("/object2/array1/1")));
assertTrue("expected v4", "v4".equals(jsonObject.query("/object2/array1/2/k4")));
assertTrue("expected v5", "v5".equals(jsonObject.query("/object2/array1/2/k5")));
assertTrue("expected v6", "v6".equals(jsonObject.query("/object2/array1/2/k6")));
assertTrue("expected 5", Integer.valueOf(5).equals(jsonObject.query("/object2/array1/2/array2/0")));
assertTrue("expected 6", Integer.valueOf(6).equals(jsonObject.query("/object2/array1/2/array2/1")));
assertTrue("expected 7", Integer.valueOf(7).equals(jsonObject.query("/object2/array1/2/array2/2")));
assertTrue("expected 8", Integer.valueOf(8).equals(jsonObject.query("/object2/array1/2/array2/3")));
assertTrue("expected 3", Integer.valueOf(3).equals(jsonObject.query("/object2/array1/3")));
assertTrue("expected 4", Integer.valueOf(4).equals(jsonObject.query("/object2/array1/4")));
}
}

View File

@@ -1,373 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import org.json.*;
import org.junit.Test;
/**
* Test specific to the {@link org.json.JSONTokener} class.
* @author John Aylward
*
*/
public class JSONTokenerTest {
/**
* verify that back() fails as expected.
* @throws IOException thrown if something unexpected happens.
*/
@Test
public void verifyBackFailureZeroIndex() throws IOException {
Reader reader = new StringReader("some test string");
try {
final JSONTokener tokener = new JSONTokener(reader);
try {
// this should fail since the index is 0;
tokener.back();
fail("Expected an exception");
} catch (JSONException e) {
assertEquals("Stepping back two steps is not supported", e.getMessage());
} catch (Exception e) {
fail("Unknown Exception type " + e.getClass().getCanonicalName()+" with message "+e.getMessage());
}
} finally {
reader.close();
}
}
/**
* verify that back() fails as expected.
* @throws IOException thrown if something unexpected happens.
*/
@Test
public void verifyBackFailureDoubleBack() throws IOException {
Reader reader = new StringReader("some test string");
try {
final JSONTokener tokener = new JSONTokener(reader);
tokener.next();
tokener.back();
try {
// this should fail since the index is 0;
tokener.back();
fail("Expected an exception");
} catch (JSONException e) {
assertEquals("Stepping back two steps is not supported", e.getMessage());
} catch (Exception e) {
fail("Unknown Exception type " + e.getClass().getCanonicalName()+" with message "+e.getMessage());
}
} finally {
reader.close();
}
}
@Test
public void testValid() {
checkValid("0",Number.class);
checkValid(" 0 ",Number.class);
checkValid("23",Number.class);
checkValid("23.5",Number.class);
checkValid(" 23.5 ",Number.class);
checkValid("null",null);
checkValid(" null ",null);
checkValid("true",Boolean.class);
checkValid(" true\n",Boolean.class);
checkValid("false",Boolean.class);
checkValid("\nfalse ",Boolean.class);
checkValid("{}",JSONObject.class);
checkValid(" {} ",JSONObject.class);
checkValid("{\"a\":1}",JSONObject.class);
checkValid(" {\"a\":1} ",JSONObject.class);
checkValid("[]",JSONArray.class);
checkValid(" [] ",JSONArray.class);
checkValid("[1,2]",JSONArray.class);
checkValid("\n\n[1,2]\n\n",JSONArray.class);
// Test should fail if default strictMode is true, pass if false
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration();
if (jsonParserConfiguration.isStrictMode()) {
try {
checkValid("1 2", String.class);
assertEquals("Expected to throw exception due to invalid string", true, false);
} catch (JSONException e) { }
} else {
checkValid("1 2", String.class);
}
}
@Test
public void testErrors() {
// Check that stream can detect that a value is found after
// the first one
checkError(" { \"a\":1 } 4 ");
checkError("null \"a\"");
checkError("{} true");
}
private Object checkValid(String testStr, Class<?> aClass) {
Object result = nextValue(testStr);
// Check class of object returned
if( null == aClass ) {
if(JSONObject.NULL.equals(result)) {
// OK
} else {
throw new JSONException("Unexpected class: "+result.getClass().getSimpleName());
}
} else {
if( null == result ) {
throw new JSONException("Unexpected null result");
} else if(!aClass.isAssignableFrom(result.getClass()) ) {
throw new JSONException("Unexpected class: "+result.getClass().getSimpleName());
}
}
return result;
}
private void checkError(String testStr) {
try {
nextValue(testStr);
fail("Error should be triggered: (\""+testStr+"\")");
} catch (JSONException e) {
// OK
}
}
/**
* Verifies that JSONTokener can read a stream that contains a value. After
* the reading is done, check that the stream is left in the correct state
* by reading the characters after. All valid cases should reach end of stream.
* @param testStr
* @return
* @throws Exception
*/
private Object nextValue(String testStr) throws JSONException {
StringReader sr = new StringReader(testStr);
try {
JSONTokener tokener = new JSONTokener(sr);
Object result = tokener.nextValue();
if( result == null ) {
throw new JSONException("Unable to find value token in JSON stream: ("+tokener+"): "+testStr);
}
char c = tokener.nextClean();
if( 0 != c ) {
throw new JSONException("Unexpected character found at end of JSON stream: "+c+ " ("+tokener+"): "+testStr);
}
return result;
} finally {
sr.close();
}
}
/**
* Tests the failure of the skipTo method with a buffered reader. Preferably
* we'd like this not to fail but at this time we don't have a good recovery.
*
* @throws IOException thrown if something unexpected happens.
*/
@Test
public void testSkipToFailureWithBufferedReader() throws IOException {
final byte[] superLongBuffer = new byte[1000001];
// fill our buffer
for(int i=0;i<superLongBuffer.length;i++) {
superLongBuffer[i] = 'A';
}
Reader reader = new BufferedReader(new InputStreamReader(
new ByteArrayInputStream(superLongBuffer)));
try {
final JSONTokener tokener = new JSONTokener(reader);
try {
// this should fail since the internal markAhead buffer is only 1,000,000
// but 'B' doesn't exist in our buffer that is 1,000,001 in size
tokener.skipTo('B');
fail("Expected exception");
} catch (JSONException e) {
assertEquals("Mark invalid", e.getMessage());
} catch (Exception e) {
fail("Unknown Exception type " + e.getClass().getCanonicalName()+" with message "+e.getMessage());
}
} finally {
reader.close();
}
}
/**
* Tests the success of the skipTo method with a String reader.
*
* @throws IOException thrown if something unexpected happens.
*/
@Test
public void testSkipToSuccessWithStringReader() throws IOException {
final StringBuilder superLongBuffer = new StringBuilder(1000001);
// fill our buffer
for(int i=0;i<superLongBuffer.length();i++) {
superLongBuffer.append('A');
}
Reader reader = new StringReader(superLongBuffer.toString());
try {
final JSONTokener tokener = new JSONTokener(reader);
try {
// this should not fail since the internal markAhead is ignored for StringReaders
tokener.skipTo('B');
} catch (Exception e) {
fail("Unknown Exception type " + e.getClass().getCanonicalName()+" with message "+e.getMessage());
}
} finally {
reader.close();
}
}
/**
* Verify that next and back are working properly and tracking the correct positions
* with different new line combinations.
*/
@Test
public void testNextBackComboWithNewLines() {
final String testString = "this is\nA test\r\nWith some different\rNew Lines";
// ^ ^ ^ ^
// index positions 0 8 16 36
final JSONTokener tokener = new JSONTokener(testString);
assertEquals(" at 0 [character 1 line 1]", tokener.toString());
assertEquals('t',tokener.next());
assertEquals(" at 1 [character 2 line 1]", tokener.toString());
tokener.skipTo('\n');
assertEquals("skipTo() improperly modifying indexes"," at 7 [character 8 line 1]", tokener.toString());
assertEquals('\n',tokener.next());
assertEquals(" at 8 [character 0 line 2]", tokener.toString());
assertEquals('A',tokener.next());
assertEquals(" at 9 [character 1 line 2]", tokener.toString());
tokener.back();
assertEquals(" at 8 [character 0 line 2]", tokener.toString());
tokener.skipTo('\r');
assertEquals("skipTo() improperly modifying indexes"," at 14 [character 6 line 2]", tokener.toString());
// verify \r\n combo doesn't increment the line twice
assertEquals('\r', tokener.next());
assertEquals(" at 15 [character 0 line 3]", tokener.toString());
assertEquals('\n', tokener.next());
assertEquals(" at 16 [character 0 line 3]", tokener.toString());
// verify stepping back after reading the \n of an \r\n combo doesn't increment the line incorrectly
tokener.back();
assertEquals(" at 15 [character 6 line 2]", tokener.toString());
assertEquals('\n', tokener.next());
assertEquals(" at 16 [character 0 line 3]", tokener.toString());
assertEquals('W', tokener.next());
assertEquals(" at 17 [character 1 line 3]", tokener.toString());
assertEquals('i', tokener.next());
assertEquals(" at 18 [character 2 line 3]", tokener.toString());
tokener.skipTo('\r');
assertEquals("skipTo() improperly modifying indexes"," at 35 [character 19 line 3]", tokener.toString());
assertEquals('\r', tokener.next());
assertEquals(" at 36 [character 0 line 4]", tokener.toString());
tokener.back();
assertEquals(" at 35 [character 19 line 3]", tokener.toString());
assertEquals('\r', tokener.next());
assertEquals(" at 36 [character 0 line 4]", tokener.toString());
assertEquals('N', tokener.next());
assertEquals(" at 37 [character 1 line 4]", tokener.toString());
// verify we get the same data just walking though, no calls to back
final JSONTokener t2 = new JSONTokener(testString);
for(int i=0; i<7; i++) {
assertTrue(t2.toString().startsWith(" at " + i + " "));
assertEquals(testString.charAt(i), t2.next());
}
assertEquals(" at 7 [character 8 line 1]", t2.toString());
assertEquals(testString.charAt(7), t2.next());
assertEquals(" at 8 [character 0 line 2]", t2.toString());
for(int i=8; i<14; i++) {
assertTrue(t2.toString().startsWith(" at " + i + " "));
assertEquals(testString.charAt(i), t2.next());
}
assertEquals(" at 14 [character 6 line 2]", t2.toString());
assertEquals('\r', t2.next());
assertEquals(" at 15 [character 0 line 3]", t2.toString());
assertEquals('\n', t2.next());
assertEquals(" at 16 [character 0 line 3]", t2.toString());
assertEquals('W', t2.next());
assertEquals(" at 17 [character 1 line 3]", t2.toString());
for(int i=17; i<37; i++) {
assertTrue(t2.toString().startsWith(" at " + i + " "));
assertEquals(testString.charAt(i), t2.next());
}
assertEquals(" at 37 [character 1 line 4]", t2.toString());
for(int i=37; i<testString.length(); i++) {
assertTrue(t2.toString().startsWith(" at " + i + " "));
assertEquals(testString.charAt(i), t2.next());
}
assertEquals(" at "+ testString.length() +" [character 9 line 4]", t2.toString());
// end of the input
assertEquals(0, t2.next());
assertFalse(t2.more());
}
@Test
public void testAutoClose(){
Reader reader = new StringReader("some test string");
try {
JSONTokener tokener = new JSONTokener(reader);
tokener.close();
tokener.next();
} catch (Exception exception){
assertEquals("Stream closed", exception.getMessage());
}
}
@Test
public void testInvalidInput_JSONObject_withoutStrictModel_shouldParseInput() {
String input = "{\"invalidInput\": [],}";
JSONTokener tokener = new JSONTokener(input);
// Test should fail if default strictMode is true, pass if false
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration();
if (jsonParserConfiguration.isStrictMode()) {
try {
Object value = tokener.nextValue();
assertEquals(new JSONObject(input).toString(), value.toString());
assertEquals("Expected to throw exception due to invalid string", true, false);
} catch (JSONException e) { }
} else {
Object value = tokener.nextValue();
assertEquals(new JSONObject(input).toString(), value.toString());
}
}
@Test
public void testInvalidInput_JSONArray_withoutStrictModel_shouldParseInput() {
String input = "[\"invalidInput\",]";
JSONTokener tokener = new JSONTokener(input);
// Test should fail if default strictMode is true, pass if false
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration();
if (jsonParserConfiguration.isStrictMode()) {
try {
Object value = tokener.nextValue();
assertEquals(new JSONArray(input).toString(), value.toString());
assertEquals("Expected to throw exception due to invalid string", true, false);
} catch (JSONException e) { }
} else {
Object value = tokener.nextValue();
assertEquals(new JSONArray(input).toString(), value.toString());
}
}
}

View File

@@ -1,102 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import java.util.*;
import static org.junit.Assert.*;
import org.json.*;
import org.junit.Test;
/**
* Tests for JSON-Java Property
*/
public class PropertyTest {
/**
* JSONObject from null properties object should
* result in an empty JSONObject.
*/
@Test
public void shouldHandleNullProperties() {
Properties properties = null;
JSONObject jsonObject = Property.toJSONObject(properties);
assertTrue("jsonObject should be empty", jsonObject.isEmpty());
}
/**
* JSONObject from empty properties object should
* result in an empty JSONObject.
*/
@Test
public void shouldHandleEmptyProperties() {
Properties properties = new Properties();
JSONObject jsonObject = Property.toJSONObject(properties);
assertTrue("jsonObject should be empty", jsonObject.isEmpty());
}
/**
* JSONObject from simple properties object.
*/
@Test
public void shouldHandleProperties() {
Properties properties = new Properties();
properties.put("Illinois", "Springfield");
properties.put("Missouri", "Jefferson City");
properties.put("Washington", "Olympia");
properties.put("California", "Sacramento");
properties.put("Indiana", "Indianapolis");
JSONObject jsonObject = Property.toJSONObject(properties);
assertTrue("jsonObject should contain 5 items", jsonObject.length() == 5);
assertTrue("jsonObject should contain Illinois property",
"Springfield".equals(jsonObject.get("Illinois")));
assertTrue("jsonObject should contain Missouri property",
"Jefferson City".equals(jsonObject.get("Missouri")));
assertTrue("jsonObject should contain Washington property",
"Olympia".equals(jsonObject.get("Washington")));
assertTrue("jsonObject should contain California property",
"Sacramento".equals(jsonObject.get("California")));
assertTrue("jsonObject should contain Indiana property",
"Indianapolis".equals(jsonObject.get("Indiana")));
}
/**
* Null JSONObject toProperties() should result in an empty
* Properties object.
*/
@Test
public void shouldHandleNullJSONProperty() {
JSONObject jsonObject= null;
Properties properties = Property.toProperties(jsonObject);
assertTrue("properties should be empty",
properties.size() == 0);
}
/**
* Properties should convert to JSONObject, and back to
* Properties without changing.
*/
@Test
public void shouldHandleJSONProperty() {
Properties properties = new Properties();
properties.put("Illinois", "Springfield");
properties.put("Missouri", "Jefferson City");
properties.put("Washington", "Olympia");
properties.put("California", "Sacramento");
properties.put("Indiana", "Indianapolis");
JSONObject jsonObject = Property.toJSONObject(properties);
Properties jsonProperties = Property.toProperties(jsonObject);
assertTrue("property objects should match",
properties.equals(jsonProperties));
}
}

View File

@@ -1,60 +0,0 @@
package org.json.junit;
import static org.junit.Assert.assertEquals;
import org.json.StringBuilderWriter;
import org.junit.Before;
import org.junit.Test;
public class StringBuilderWriterTest {
private StringBuilderWriter writer;
@Before
public void setUp() {
writer = new StringBuilderWriter();
}
@Test
public void testWriteChar() {
writer.write('a');
assertEquals("a", writer.toString());
}
@Test
public void testWriteCharArray() {
char[] chars = {'a', 'b', 'c'};
writer.write(chars, 0, 3);
assertEquals("abc", writer.toString());
}
@Test
public void testWriteString() {
writer.write("hello");
assertEquals("hello", writer.toString());
}
@Test
public void testWriteStringWithOffsetAndLength() {
writer.write("hello world", 6, 5);
assertEquals("world", writer.toString());
}
@Test
public void testAppendCharSequence() {
writer.append("hello");
assertEquals("hello", writer.toString());
}
@Test
public void testAppendCharSequenceWithStartAndEnd() {
CharSequence csq = "hello world";
writer.append(csq, 6, 11);
assertEquals("world", writer.toString());
}
@Test
public void testAppendChar() {
writer.append('a');
assertEquals("a", writer.toString());
}
}

View File

@@ -1,201 +0,0 @@
package org.json.junit;
/*
Public Domain.
*/
import static org.junit.Assert.*;
import java.util.*;
import org.json.*;
/**
* These are helpful utility methods that perform basic comparisons
* between various objects. In most cases, the comparisons are not
* order-dependent, or else the order is known.
*/
public class Util {
/**
* Compares two JSONArrays for equality.
* The arrays need not be in the same order.
* @param jsonArray created by the code to be tested
* @param expectedJsonArray created specifically for comparing
*/
public static void compareActualVsExpectedJsonArrays(JSONArray jsonArray,
JSONArray expectedJsonArray) {
assertTrue("jsonArray lengths should be equal",
jsonArray.length() == expectedJsonArray.length());
for (int i = 0; i < jsonArray.length(); ++i) {
Object value = jsonArray.get(i);
Object expectedValue = expectedJsonArray.get(i);
compareActualVsExpectedObjects(value, expectedValue);
}
}
/**
* Compares two JSONObjects for equality. The objects need not be
* in the same order
* @param jsonObject created by the code to be tested
* @param expectedJsonObject created specifically for comparing
*/
public static void compareActualVsExpectedJsonObjects(
JSONObject jsonObject, JSONObject expectedJsonObject) {
assertTrue("jsonObjects should have the same length",
jsonObject.length() == expectedJsonObject.length());
Iterator<String> keys = jsonObject.keys();
while (keys.hasNext()) {
String key = keys.next();
Object value = jsonObject.get(key);
Object expectedValue = expectedJsonObject.get(key);
compareActualVsExpectedObjects(value, expectedValue);
}
}
/**
* Compare two objects for equality. Might be JSONArray, JSONObject,
* or something else.
* @param value created by the code to be tested
* @param expectedValue created specifically for comparing
*/
private static void compareActualVsExpectedObjects(Object value,
Object expectedValue) {
if (value instanceof JSONObject && expectedValue instanceof JSONObject) {
// Compare JSONObjects
JSONObject jsonObject = (JSONObject)value;
JSONObject expectedJsonObject = (JSONObject)expectedValue;
compareActualVsExpectedJsonObjects(
jsonObject, expectedJsonObject);
} else if (value instanceof JSONArray && expectedValue instanceof JSONArray) {
// Compare JSONArrays
JSONArray jsonArray = (JSONArray)value;
JSONArray expectedJsonArray = (JSONArray)expectedValue;
compareActualVsExpectedJsonArrays(
jsonArray, expectedJsonArray);
} else {
/**
* Compare all other types using toString(). First, the types must
* also be equal, unless both are Number type. Certain helper
* classes (e.g. XML) may create Long instead of Integer for small
* int values.
*/
if (!(value instanceof Number && expectedValue instanceof Number)) {
// Non-Number and non-matching types
assertEquals("object types should be equal ",
expectedValue.getClass().toString(),
value.getClass().toString()
);
}
/**
* Same types or both Numbers, compare by toString()
*/
assertEquals("values should be equal",
expectedValue.toString(),
value.toString()
);
}
}
/**
* Asserts that all JSONObject maps are the same as the default ctor
* @param jsonObjects list of objects to be tested
*/
public static void checkJSONObjectsMaps(List<JSONObject> jsonObjects) {
if (jsonObjects == null || jsonObjects.size() == 0) {
return;
}
Class<? extends Map> mapType = new JSONObject().getMapType();
for (JSONObject jsonObject : jsonObjects) {
if (jsonObject != null) {
assertTrue(mapType == jsonObject.getMapType());
checkJSONObjectMaps(jsonObject, mapType);
}
}
}
/**
* Asserts that all JSONObject maps are the same as the default ctor
* @param jsonObject the object to be tested
*/
public static void checkJSONObjectMaps(JSONObject jsonObject) {
if (jsonObject != null) {
checkJSONObjectMaps(jsonObject, jsonObject.getMapType());
}
}
/**
* Asserts that all JSONObject maps are the same as mapType
* @param jsonObject object to be tested
* @param mapType mapType to test against
*/
public static void checkJSONObjectMaps(JSONObject jsonObject, Class<? extends Map> mapType) {
if (mapType == null) {
mapType = new JSONObject().getMapType();
}
Set<String> keys = jsonObject.keySet();
for (String key : keys) {
Object val = jsonObject.get(key);
if (val instanceof JSONObject) {
JSONObject jsonObjectVal = (JSONObject) val;
assertTrue(mapType == ((JSONObject) val).getMapType());
checkJSONObjectMaps(jsonObjectVal, mapType);
} else if (val instanceof JSONArray) {
JSONArray jsonArrayVal = (JSONArray)val;
checkJSONArrayMaps(jsonArrayVal, mapType);
}
}
}
/**
* Asserts that all JSONObject maps in the JSONArray object match the default map
* @param jsonArrays list of JSONArray objects to be tested
*/
public static void checkJSONArraysMaps(List<JSONArray> jsonArrays) {
if (jsonArrays == null || jsonArrays.size() == 0) {
return;
}
Class<? extends Map> mapType = new JSONObject().getMapType();
for (JSONArray jsonArray : jsonArrays) {
if (jsonArray != null) {
checkJSONArrayMaps(jsonArray, mapType);
}
}
}
/**
* Asserts that all JSONObject maps in the JSONArray object match mapType
* @param jsonArray object to be tested
* @param mapType map type to be tested against
*/
public static void checkJSONArrayMaps(JSONArray jsonArray, Class<? extends Map> mapType) {
if (jsonArray == null) {
return;
}
if (mapType == null) {
mapType = new JSONObject().getMapType();
}
Iterator<Object> it = jsonArray.iterator();
while (it.hasNext()) {
Object val = it.next();
if (val instanceof JSONObject) {
JSONObject jsonObjectVal = (JSONObject)val;
checkJSONObjectMaps(jsonObjectVal, mapType);
} else if (val instanceof JSONArray) {
JSONArray jsonArrayVal = (JSONArray)val;
checkJSONArrayMaps(jsonArrayVal, mapType);
}
}
}
/**
* Asserts that all JSONObject maps nested in the JSONArray match
* the default mapType
* @param jsonArray the object to be tested
*/
public static void checkJSONArrayMaps(JSONArray jsonArray) {
if (jsonArray != null) {
checkJSONArrayMaps(jsonArray, null);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +0,0 @@
package org.json.junit.data;
/**
* test class for verifying write errors.
* @author John Aylward
*
*/
public class BrokenToString {
@Override
public String toString() {
throw new IllegalStateException("Something went horribly wrong!");
}
}

View File

@@ -1,66 +0,0 @@
/**
*
*/
package org.json.junit.data;
import java.io.Closeable;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
/**
* Object for testing the exception handling in {@link org.json.JSONObject#populateMap}.
*
* @author John Aylward
*/
public class ExceptionalBean {
/**
* @return a closeable.
*/
public Closeable getCloseable() {
// anonymous inner class did not work...
return new MyCloseable();
}
/**
* @return Nothing really. Just can't be void.
* @throws IllegalAccessException
* always thrown
*/
public int getIllegalAccessException() throws IllegalAccessException {
throw new IllegalAccessException("Yup, it's illegal");
}
/**
* @return Nothing really. Just can't be void.
* @throws IllegalArgumentException
* always thrown
*/
public int getIllegalArgumentException() throws IllegalArgumentException {
throw new IllegalArgumentException("Yup, it's illegal");
}
/**
* @return Nothing really. Just can't be void.
* @throws InvocationTargetException
* always thrown
*/
public int getInvocationTargetException() throws InvocationTargetException {
throw new InvocationTargetException(new Exception("Yup, it's illegal"));
}
/** My closeable class. */
public static final class MyCloseable implements Closeable {
/**
* @return a string
*/
public String getString() {
return "Yup, it's closeable";
}
@Override
public void close() throws IOException {
throw new IOException("Closing is too hard!");
}
}
}

View File

@@ -1,180 +0,0 @@
package org.json.junit.data;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
/**
* basic fraction class, no frills.
* @author John Aylward
*
*/
public class Fraction extends Number implements Comparable<Fraction> {
/**
* serial id.
*/
private static final long serialVersionUID = 1L;
/**
* value as a big decimal.
*/
private final BigDecimal bigDecimal;
/**
* value of the denominator.
*/
private final BigInteger denominator;
/**
* value of the numerator.
*/
private final BigInteger numerator;
/**
* @param numerator
* numerator
* @param denominator
* denominator
*/
public Fraction(final BigInteger numerator, final BigInteger denominator) {
super();
if (numerator == null || denominator == null) {
throw new IllegalArgumentException("All values must be non-null");
}
if (denominator.compareTo(BigInteger.ZERO)==0) {
throw new IllegalArgumentException("Divide by zero");
}
final BigInteger n;
final BigInteger d;
// normalize fraction
if (denominator.signum()<0) {
n = numerator.negate();
d = denominator.negate();
} else {
n = numerator;
d = denominator;
}
this.numerator = n;
this.denominator = d;
if (n.compareTo(BigInteger.ZERO)==0) {
this.bigDecimal = BigDecimal.ZERO;
} else if (n.compareTo(d)==0) {// i.e. 4/4, 10/10
this.bigDecimal = BigDecimal.ONE;
} else {
this.bigDecimal = new BigDecimal(this.numerator).divide(new BigDecimal(this.denominator),
RoundingMode.HALF_EVEN);
}
}
/**
* @param numerator
* numerator
* @param denominator
* denominator
*/
public Fraction(final long numerator, final long denominator) {
this(BigInteger.valueOf(numerator),BigInteger.valueOf(denominator));
}
/**
* @return the decimal
*/
public BigDecimal bigDecimalValue() {
return this.bigDecimal;
}
@Override
public int compareTo(final Fraction o) {
// .equals call this, so no .equals compare allowed
// if they are the same reference, just return equals
if (this == o) {
return 0;
}
// if my denominators are already equal, just compare the numerators
if (this.denominator.compareTo(o.denominator)==0) {
return this.numerator.compareTo(o.numerator);
}
// get numerators of common denominators
// a x ay xb
// --- --- = ---- ----
// b y by yb
final BigInteger thisN = this.numerator.multiply(o.denominator);
final BigInteger otherN = o.numerator.multiply(this.denominator);
return thisN.compareTo(otherN);
}
@Override
public double doubleValue() {
return this.bigDecimal.doubleValue();
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
final Fraction other = (Fraction) obj;
return this.compareTo(other) == 0;
}
@Override
public float floatValue() {
return this.bigDecimal.floatValue();
}
/**
* @return the denominator
*/
public BigInteger getDenominator() {
return this.denominator;
}
/**
* @return the numerator
*/
public BigInteger getNumerator() {
return this.numerator;
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (this.bigDecimal == null ? 0 : this.bigDecimal.hashCode());
return result;
}
@Override
public int intValue() {
return this.bigDecimal.intValue();
}
@Override
public long longValue() {
return this.bigDecimal.longValue();
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return this.numerator + "/" + this.denominator;
}
}

View File

@@ -1,79 +0,0 @@
package org.json.junit.data;
import java.io.StringReader;
/**
*
* @author John Aylward
*
* @param <T>
* generic number value
*/
public class GenericBean<T extends Number> implements MyBean {
/**
* @param genericValue
* value to initiate with
*/
public GenericBean(T genericValue) {
super();
this.genericValue = genericValue;
}
/** */
protected T genericValue;
/** to be used by the calling test to see how often the getter is called */
public int genericGetCounter;
/** to be used by the calling test to see how often the setter is called */
public int genericSetCounter;
/** @return the genericValue */
public T getGenericValue() {
this.genericGetCounter++;
return this.genericValue;
}
/**
* @param genericValue
* generic value to set
*/
public void setGenericValue(T genericValue) {
this.genericSetCounter++;
this.genericValue = genericValue;
}
@Override
public Integer getIntKey() {
return Integer.valueOf(42);
}
@Override
public Double getDoubleKey() {
return Double.valueOf(4.2);
}
@Override
public String getStringKey() {
return "MyString Key";
}
@Override
public String getEscapeStringKey() {
return "\"My String with \"s";
}
@Override
public Boolean isTrueKey() {
return Boolean.TRUE;
}
@Override
public Boolean isFalseKey() {
return Boolean.FALSE;
}
@Override
public StringReader getStringReaderKey() {
return new StringReader("Some String Value in a reader");
}
}

View File

@@ -1,69 +0,0 @@
/**
*
*/
package org.json.junit.data;
/**
* @author john
*
*/
public class GenericBeanInt extends GenericBean<Integer> {
/** */
final char a = 'A';
/** @return the a */
public char getA() {
return this.a;
}
/**
* Should not be beanable
*
* @return false
*/
public boolean getable() {
return false;
}
/**
* Should not be beanable
*
* @return false
*/
public boolean get() {
return false;
}
/**
* Should not be beanable
*
* @return false
*/
public boolean is() {
return false;
}
/**
* Should be beanable
*
* @return false
*/
public boolean isB() {
return this.genericValue.equals((Integer.valueOf(this.a+1)));
}
/**
* @param genericValue
* the value to initiate with.
*/
public GenericBeanInt(Integer genericValue) {
super(genericValue);
}
/** override to generate a bridge method */
@Override
public Integer getGenericValue() {
return super.getGenericValue();
}
}

View File

@@ -1,16 +0,0 @@
package org.json.junit.data;
import java.io.*;
/**
* Used in testing when Bean behavior is needed
*/
public interface MyBean {
public Integer getIntKey();
public Double getDoubleKey();
public String getStringKey();
public String getEscapeStringKey();
public Boolean isTrueKey();
public Boolean isFalseKey();
public StringReader getStringReaderKey();
}

View File

@@ -1,20 +0,0 @@
package org.json.junit.data;
import org.json.JSONPropertyName;
/**
* Test bean for the {@link JSONPropertyName} annotation.
*/
public class MyBeanCustomName implements MyBeanCustomNameInterface {
public int getSomeInt() { return 42; }
@JSONPropertyName("")
public long getSomeLong() { return 42L; }
@JSONPropertyName("myStringField")
public String getSomeString() { return "someStringValue"; }
@JSONPropertyName("Some Weird NAme that Normally Wouldn't be possible!")
public double getMyDouble() { return 0.0d; }
@Override
public float getSomeFloat() { return 2.0f; }
@Override
public int getIgnoredInt() { return 40; }
}

View File

@@ -1,11 +0,0 @@
package org.json.junit.data;
import org.json.JSONPropertyIgnore;
import org.json.JSONPropertyName;
public interface MyBeanCustomNameInterface {
@JSONPropertyName("InterfaceField")
float getSomeFloat();
@JSONPropertyIgnore
int getIgnoredInt();
}

View File

@@ -1,32 +0,0 @@
/**
*
*/
package org.json.junit.data;
import org.json.JSONPropertyIgnore;
import org.json.JSONPropertyName;
/**
* Test bean to verify that the {@link org.json.JSONPropertyName} annotation
* is inherited.
*/
public class MyBeanCustomNameSubClass extends MyBeanCustomName {
@Override
@JSONPropertyName("forcedInt")
public int getIgnoredInt() { return 42*42; }
@Override
@JSONPropertyName("newIntFieldName")
public int getSomeInt() { return 43; }
@Override
public String getSomeString() { return "subClassString"; }
@Override
@JSONPropertyName("AMoreNormalName")
public double getMyDouble() { return 1.0d; }
@Override
public float getSomeFloat() { return 3.0f; }
@JSONPropertyIgnore
@JSONPropertyName("ShouldBeIgnored")
public boolean getShouldNotBeJSON() { return true; }
@JSONPropertyName("Getable")
public boolean getable() { return true; }
}

View File

@@ -1,11 +0,0 @@
package org.json.junit.data;
import java.math.*;
/**
* Used in testing when a Bean containing big numbers is needed
*/
public interface MyBigNumberBean {
public BigInteger getBigInteger();
public BigDecimal getBigDecimal();
}

View File

@@ -1,10 +0,0 @@
package org.json.junit.data;
/**
* An enum with no methods or data
*/
public enum MyEnum {
VAL1,
VAL2,
VAL3;
}

View File

@@ -1,22 +0,0 @@
package org.json.junit.data;
/**
* this is simply a class that contains some enum instances
*/
public class MyEnumClass {
private MyEnum myEnum;
private MyEnumField myEnumField;
public MyEnum getMyEnum() {
return this.myEnum;
}
public void setMyEnum(MyEnum myEnum) {
this.myEnum = myEnum;
}
public MyEnumField getMyEnumField() {
return this.myEnumField;
}
public void setMyEnumField(MyEnumField myEnumField) {
this.myEnumField = myEnumField;
}
}

View File

@@ -1,28 +0,0 @@
package org.json.junit.data;
/**
* An enum that contains getters and some internal fields
*/
@SuppressWarnings("boxing")
public enum MyEnumField {
VAL1(1, "val 1"),
VAL2(2, "val 2"),
VAL3(3, "val 3");
private String value;
private Integer intVal;
private MyEnumField(Integer intVal, String value) {
this.value = value;
this.intVal = intVal;
}
public String getValue() {
return this.value;
}
public Integer getIntVal() {
return this.intVal;
}
@Override
public String toString(){
return this.value;
}
}

View File

@@ -1,14 +0,0 @@
package org.json.junit.data;
import org.json.*;
/**
* Used in testing when a JSONString is needed
*/
public class MyJsonString implements JSONString {
@Override
public String toJSONString() {
return "my string";
}
}

View File

@@ -1,12 +0,0 @@
package org.json.junit.data;
public class MyLocaleBean {
private final String id = "beanId";
private final String i = "beanI";
public String getId() {
return this.id;
}
public String getI() {
return this.i;
}
}

View File

@@ -1,97 +0,0 @@
package org.json.junit.data;
import java.math.BigDecimal;
/**
* Number override for testing. Number overrides should always override
* toString, hashCode, and Equals.
*
* @see <a
* href="https://docs.oracle.com/javase/tutorial/java/data/numberclasses.html">The
* Numbers Classes</a>
* @see <a
* href="https://docs.oracle.com/javase/tutorial/java/data/numberformat.html">Formatting
* Numeric Print Output</a>
*
* @author John Aylward
*/
public class MyNumber extends Number {
private Number number = BigDecimal.valueOf(42);
/**
*/
private static final long serialVersionUID = 1L;
/**
* @return number!
*/
public Number getNumber() {
return this.number;
}
@Override
public int intValue() {
return getNumber().intValue();
}
@Override
public long longValue() {
return getNumber().longValue();
}
@Override
public float floatValue() {
return getNumber().floatValue();
}
@Override
public double doubleValue() {
return getNumber().doubleValue();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*
* Number overrides should in general always override the toString method.
*/
@Override
public String toString() {
return getNumber().toString();
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.number == null) ? 0 : this.number.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MyNumber)) {
return false;
}
MyNumber other = (MyNumber) obj;
if (this.number == null) {
if (other.number != null) {
return false;
}
} else if (!this.number.equals(other.number)) {
return false;
}
return true;
}
}

View File

@@ -1,13 +0,0 @@
package org.json.junit.data;
/**
* Class that holds our MyNumber override as a property.
* @author John Aylward
*/
public class MyNumberContainer {
private MyNumber myNumber = new MyNumber();
/**
* @return a MyNumber.
*/
public Number getMyNumber() {return this.myNumber;}
}

View File

@@ -1,10 +0,0 @@
package org.json.junit.data;
/**
* Need a class with some public data members for testing
*/
@SuppressWarnings("boxing")
public class MyPublicClass {
public Integer publicInt = 42;
public String publicString = "abc";
}

View File

@@ -1,23 +0,0 @@
package org.json.junit.data;
/**
* test class for verifying if recursively defined bean can be correctly identified
* @author Zetmas
*
*/
public class RecursiveBean {
private String name;
private Object reference;
private Object reference2;
public String getName() { return name; }
public Object getRef() {return reference;}
public Object getRef2() {return reference2;}
public void setRef(Object refObj) {reference = refObj;}
public void setRef2(Object refObj) {reference2 = refObj;}
public RecursiveBean(String name) {
this.name = name;
reference = null;
reference2 = null;
}
}

View File

@@ -1,33 +0,0 @@
package org.json.junit.data;
/** test class for verifying if recursively defined bean can be correctly identified */
public class RecursiveBeanEquals {
private final String name;
private Object reference;
public RecursiveBeanEquals(String name) {
this.name = name;
}
public String getName() {
return name;
}
public Object getRef() {
return reference;
}
public void setRef(Object refObj) {
reference = refObj;
}
@Override
public boolean equals(Object other) {
return other instanceof RecursiveBeanEquals && name.equals(((RecursiveBeanEquals) other).name);
}
@Override
public int hashCode() {
return name.hashCode();
}
}

View File

@@ -1,91 +0,0 @@
package org.json.junit.data;
/**
* Sample singleton for use with bean testing.
*
* @author John Aylward
*
*/
public final class Singleton {
/** */
private int someInt;
/** */
private String someString;
/** single instance. */
private static final Singleton INSTANCE = new Singleton();
/** @return the singleton instance. */
public static final Singleton getInstance() {
return INSTANCE;
}
/** */
private Singleton() {
if (INSTANCE != null) {
throw new IllegalStateException("Already instantiated");
}
}
@Override
protected Object clone() throws CloneNotSupportedException {
return INSTANCE;
}
/** @return someInt */
public int getSomeInt() {
return this.someInt;
}
/**
* sets someInt.
*
* @param someInt
* the someInt to set
*/
public void setSomeInt(int someInt) {
this.someInt = someInt;
}
/** @return someString */
public String getSomeString() {
return this.someString;
}
/**
* sets someString.
*
* @param someString
* the someString to set
*/
public void setSomeString(String someString) {
this.someString = someString;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.someInt;
result = prime * result + ((this.someString == null) ? 0 : this.someString.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Singleton other = (Singleton) obj;
if (this.someInt != other.someInt)
return false;
if (this.someString == null) {
if (other.someString != null)
return false;
} else if (!this.someString.equals(other.someString))
return false;
return true;
}
}

View File

@@ -1,62 +0,0 @@
package org.json.junit.data;
/**
* Sample singleton done as an Enum for use with bean testing.
*
* @author John Aylward
*
*/
public enum SingletonEnum {
/**
* the singleton instance.
*/
INSTANCE;
/** */
private int someInt;
/** */
private String someString;
/** single instance. */
/**
* @return the singleton instance. In a real application, I'd hope no one did
* this to an enum singleton.
*/
public static final SingletonEnum getInstance() {
return INSTANCE;
}
/** */
private SingletonEnum() {
}
/** @return someInt */
public int getSomeInt() {
return this.someInt;
}
/**
* sets someInt.
*
* @param someInt
* the someInt to set
*/
public void setSomeInt(int someInt) {
this.someInt = someInt;
}
/** @return someString */
public String getSomeString() {
return this.someString;
}
/**
* sets someString.
*
* @param someString
* the someString to set
*/
public void setSomeString(String someString) {
this.someString = someString;
}
}

View File

@@ -1,19 +0,0 @@
package org.json.junit.data;
import java.util.*;
/**
* A resource bundle class
*/
public class StringsResourceBundle extends ListResourceBundle {
@Override
public Object[][] getContents() {
return contents;
}
static final Object[][] contents = {
{"greetings.hello", "Hello, "},
{"greetings.world", "World!"},
{"farewells.later", "Later, "},
{"farewells.gator", "Alligator!"}
};
}

View File

@@ -1,68 +0,0 @@
/**
*
*/
package org.json.junit.data;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author John Aylward
*/
public class WeirdList {
/** */
private final List<Integer> list = new ArrayList<>();
/**
* @param vals
*/
public WeirdList(Integer... vals) {
this.list.addAll(Arrays.asList(vals));
}
/**
* @return a copy of the list
*/
public List<Integer> get() {
return new ArrayList<>(this.list);
}
/**
* @return a copy of the list
*/
public List<Integer> getALL() {
return new ArrayList<>(this.list);
}
/**
* get a value at an index.
*
* @param i
* index to get
* @return the value at the index
*/
public Integer get(int i) {
return this.list.get(i);
}
/**
* get a value at an index.
*
* @param i
* index to get
* @return the value at the index
*/
@SuppressWarnings("boxing")
public int getInt(int i) {
return this.list.get(i);
}
/**
* @param value
* new value to add to the end of the list
*/
public void add(Integer value) {
this.list.add(value);
}
}

View File

@@ -1,189 +0,0 @@
{
"clinical_study": {
"brief_summary": {
"textblock": "CLEAR SYNERGY is an international multi center 2x2 randomized placebo controlled trial of"
},
"brief_title": "CLEAR SYNERGY Neutrophil Substudy",
"overall_status": "Recruiting",
"eligibility": {
"study_pop": {
"textblock": "Patients who are randomized to the drug RCT portion of the CLEAR SYNERGY (OASIS 9) trial"
},
"minimum_age": "19 Years",
"sampling_method": "Non-Probability Sample",
"gender": "All",
"criteria": {
"textblock": "Inclusion Criteria:"
},
"healthy_volunteers": "No",
"maximum_age": "110 Years"
},
"number_of_groups": "2",
"source": "NYU Langone Health",
"location_countries": {
"country": "United States"
},
"study_design_info": {
"time_perspective": "Prospective",
"observational_model": "Other"
},
"last_update_submitted_qc": "September 10, 2019",
"intervention_browse": {
"mesh_term": "Colchicine"
},
"official_title": "Studies on the Effects of Colchicine on Neutrophil Biology in Acute Myocardial Infarction: A Substudy of the CLEAR SYNERGY (OASIS 9) Trial",
"primary_completion_date": {
"type": "Anticipated",
"content": "February 1, 2021"
},
"sponsors": {
"lead_sponsor": {
"agency_class": "Other",
"agency": "NYU Langone Health"
},
"collaborator": [
{
"agency_class": "Other",
"agency": "Population Health Research Institute"
},
{
"agency_class": "NIH",
"agency": "National Heart, Lung, and Blood Institute (NHLBI)"
}
]
},
"overall_official": {
"role": "Principal Investigator",
"affiliation": "NYU School of Medicine",
"last_name": "Binita Shah, MD"
},
"overall_contact_backup": {
"last_name": "Binita Shah, MD"
},
"condition_browse": {
"mesh_term": [
"Myocardial Infarction",
"ST Elevation Myocardial Infarction",
"Infarction"
]
},
"overall_contact": {
"phone": "646-501-9648",
"last_name": "Fatmira Curovic",
"email": "fatmira.curovic@nyumc.org"
},
"responsible_party": {
"responsible_party_type": "Principal Investigator",
"investigator_title": "Assistant Professor of Medicine",
"investigator_full_name": "Binita Shah",
"investigator_affiliation": "NYU Langone Health"
},
"study_first_submitted_qc": "March 12, 2019",
"start_date": {
"type": "Actual",
"content": "March 4, 2019"
},
"has_expanded_access": "No",
"study_first_posted": {
"type": "Actual",
"content": "March 14, 2019"
},
"arm_group": [
{
"arm_group_label": "Colchicine"
},
{
"arm_group_label": "Placebo"
}
],
"primary_outcome": {
"measure": "soluble L-selectin",
"time_frame": "between baseline and 3 months",
"description": "Change in soluble L-selectin between baseline and 3 mo after STEMI in the placebo vs. colchicine groups."
},
"secondary_outcome": [
{
"measure": "Other soluble markers of neutrophil activity",
"time_frame": "between baseline and 3 months",
"description": "Other markers of neutrophil activity will be evaluated at baseline and 3 months after STEMI (myeloperoxidase, matrix metalloproteinase-9, neutrophil gelatinase-associated lipocalin, neutrophil elastase, intercellular/vascular cellular adhesion molecules)"
},
{
"measure": "Markers of systemic inflammation",
"time_frame": "between baseline and 3 months",
"description": "Markers of systemic inflammation will be evaluated at baseline and 3 months after STEMI (high sensitive CRP, IL-1β)"
},
{
"measure": "Neutrophil-driven responses that may further propagate injury",
"time_frame": "between baseline and 3 months",
"description": "Neutrophil-driven responses that may further propagate injury will be evaluated at baseline and 3 months after STEMI (neutrophil extracellular traps, neutrophil-derived microparticles)"
}
],
"oversight_info": {
"is_fda_regulated_drug": "No",
"is_fda_regulated_device": "No",
"has_dmc": "No"
},
"last_update_posted": {
"type": "Actual",
"content": "September 12, 2019"
},
"id_info": {
"nct_id": "NCT03874338",
"org_study_id": "18-01323",
"secondary_id": "1R01HL146206"
},
"enrollment": {
"type": "Anticipated",
"content": "670"
},
"study_first_submitted": "March 12, 2019",
"condition": [
"Neutrophils.Hypersegmented | Bld-Ser-Plas",
"STEMI - ST Elevation Myocardial Infarction"
],
"study_type": "Observational",
"required_header": {
"download_date": "ClinicalTrials.gov processed this data on July 19, 2020",
"link_text": "Link to the current ClinicalTrials.gov record.",
"url": "https://clinicaltrials.gov/show/NCT03874338"
},
"last_update_submitted": "September 10, 2019",
"completion_date": {
"type": "Anticipated",
"content": "February 1, 2022"
},
"location": {
"contact": {
"phone": "646-501-9648",
"last_name": "Fatmira Curovic",
"email": "fatmira.curovic@nyumc.org"
},
"facility": {
"address": {
"zip": "10016",
"country": "United States",
"city": "New York",
"state": "New York"
},
"name": "NYU School of Medicine"
},
"status": "Recruiting",
"contact_backup": {
"last_name": "Binita Shah, MD"
}
},
"intervention": {
"intervention_type": "Drug",
"arm_group_label": [
"Colchicine",
"Placebo"
],
"description": "Participants in the main CLEAR SYNERGY trial are randomized to colchicine/spironolactone versus placebo in a 2x2 factorial design. The substudy is interested in the evaluation of biospecimens obtained from patients in the colchicine vs placebo group.",
"intervention_name": "Colchicine Pill"
},
"patient_data": {
"sharing_ipd": "No"
},
"verification_date": "September 2019"
}
}

View File

@@ -1,169 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<clinical_study>
<!-- This xml conforms to an XML Schema at:
https://clinicaltrials.gov/ct2/html/images/info/public.xsd -->
<required_header>
<download_date>ClinicalTrials.gov processed this data on July 19, 2020</download_date>
<link_text>Link to the current ClinicalTrials.gov record.</link_text>
<url>https://clinicaltrials.gov/show/NCT03874338</url>
</required_header>
<id_info>
<org_study_id>18-01323</org_study_id>
<secondary_id>1R01HL146206</secondary_id>
<nct_id>NCT03874338</nct_id>
</id_info>
<brief_title>CLEAR SYNERGY Neutrophil Substudy</brief_title>
<official_title>Studies on the Effects of Colchicine on Neutrophil Biology in Acute Myocardial Infarction: A Substudy of the CLEAR SYNERGY (OASIS 9) Trial</official_title>
<sponsors>
<lead_sponsor>
<agency>NYU Langone Health</agency>
<agency_class>Other</agency_class>
</lead_sponsor>
<collaborator>
<agency>Population Health Research Institute</agency>
<agency_class>Other</agency_class>
</collaborator>
<collaborator>
<agency>National Heart, Lung, and Blood Institute (NHLBI)</agency>
<agency_class>NIH</agency_class>
</collaborator>
</sponsors>
<source>NYU Langone Health</source>
<oversight_info>
<has_dmc>No</has_dmc>
<is_fda_regulated_drug>No</is_fda_regulated_drug>
<is_fda_regulated_device>No</is_fda_regulated_device>
</oversight_info>
<brief_summary>
<textblock>
CLEAR SYNERGY is an international multi center 2x2 randomized placebo controlled trial of
</textblock>
</brief_summary>
<overall_status>Recruiting</overall_status>
<start_date type="Actual">March 4, 2019</start_date>
<completion_date type="Anticipated">February 1, 2022</completion_date>
<primary_completion_date type="Anticipated">February 1, 2021</primary_completion_date>
<study_type>Observational</study_type>
<has_expanded_access>No</has_expanded_access>
<study_design_info>
<observational_model>Other</observational_model>
<time_perspective>Prospective</time_perspective>
</study_design_info>
<primary_outcome>
<measure>soluble L-selectin</measure>
<time_frame>between baseline and 3 months</time_frame>
<description>Change in soluble L-selectin between baseline and 3 mo after STEMI in the placebo vs. colchicine groups.</description>
</primary_outcome>
<secondary_outcome>
<measure>Other soluble markers of neutrophil activity</measure>
<time_frame>between baseline and 3 months</time_frame>
<description>Other markers of neutrophil activity will be evaluated at baseline and 3 months after STEMI (myeloperoxidase, matrix metalloproteinase-9, neutrophil gelatinase-associated lipocalin, neutrophil elastase, intercellular/vascular cellular adhesion molecules)</description>
</secondary_outcome>
<secondary_outcome>
<measure>Markers of systemic inflammation</measure>
<time_frame>between baseline and 3 months</time_frame>
<description>Markers of systemic inflammation will be evaluated at baseline and 3 months after STEMI (high sensitive CRP, IL-1β)</description>
</secondary_outcome>
<secondary_outcome>
<measure>Neutrophil-driven responses that may further propagate injury</measure>
<time_frame>between baseline and 3 months</time_frame>
<description>Neutrophil-driven responses that may further propagate injury will be evaluated at baseline and 3 months after STEMI (neutrophil extracellular traps, neutrophil-derived microparticles)</description>
</secondary_outcome>
<number_of_groups>2</number_of_groups>
<enrollment type="Anticipated">670</enrollment>
<condition>Neutrophils.Hypersegmented &#X7C; Bld-Ser-Plas</condition>
<condition>STEMI - ST Elevation Myocardial Infarction</condition>
<arm_group>
<arm_group_label>Colchicine</arm_group_label>
</arm_group>
<arm_group>
<arm_group_label>Placebo</arm_group_label>
</arm_group>
<intervention>
<intervention_type>Drug</intervention_type>
<intervention_name>Colchicine Pill</intervention_name>
<description>Participants in the main CLEAR SYNERGY trial are randomized to colchicine/spironolactone versus placebo in a 2x2 factorial design. The substudy is interested in the evaluation of biospecimens obtained from patients in the colchicine vs placebo group.</description>
<arm_group_label>Colchicine</arm_group_label>
<arm_group_label>Placebo</arm_group_label>
</intervention>
<eligibility>
<study_pop>
<textblock>
Patients who are randomized to the drug RCT portion of the CLEAR SYNERGY (OASIS 9) trial
</textblock>
</study_pop>
<sampling_method>Non-Probability Sample</sampling_method>
<criteria>
<textblock>
Inclusion Criteria:
</textblock>
</criteria>
<gender>All</gender>
<minimum_age>19 Years</minimum_age>
<maximum_age>110 Years</maximum_age>
<healthy_volunteers>No</healthy_volunteers>
</eligibility>
<overall_official>
<last_name>Binita Shah, MD</last_name>
<role>Principal Investigator</role>
<affiliation>NYU School of Medicine</affiliation>
</overall_official>
<overall_contact>
<last_name>Fatmira Curovic</last_name>
<phone>646-501-9648</phone>
<email>fatmira.curovic@nyumc.org</email>
</overall_contact>
<overall_contact_backup>
<last_name>Binita Shah, MD</last_name>
</overall_contact_backup>
<location>
<facility>
<name>NYU School of Medicine</name>
<address>
<city>New York</city>
<state>New York</state>
<zip>10016</zip>
<country>United States</country>
</address>
</facility>
<status>Recruiting</status>
<contact>
<last_name>Fatmira Curovic</last_name>
<phone>646-501-9648</phone>
<email>fatmira.curovic@nyumc.org</email>
</contact>
<contact_backup>
<last_name>Binita Shah, MD</last_name>
</contact_backup>
</location>
<location_countries>
<country>United States</country>
</location_countries>
<verification_date>September 2019</verification_date>
<study_first_submitted>March 12, 2019</study_first_submitted>
<study_first_submitted_qc>March 12, 2019</study_first_submitted_qc>
<study_first_posted type="Actual">March 14, 2019</study_first_posted>
<last_update_submitted>September 10, 2019</last_update_submitted>
<last_update_submitted_qc>September 10, 2019</last_update_submitted_qc>
<last_update_posted type="Actual">September 12, 2019</last_update_posted>
<responsible_party>
<responsible_party_type>Principal Investigator</responsible_party_type>
<investigator_affiliation>NYU Langone Health</investigator_affiliation>
<investigator_full_name>Binita Shah</investigator_full_name>
<investigator_title>Assistant Professor of Medicine</investigator_title>
</responsible_party>
<condition_browse>
<!-- CAUTION: The following MeSH terms are assigned with an imperfect algorithm -->
<mesh_term>Myocardial Infarction</mesh_term>
<mesh_term>ST Elevation Myocardial Infarction</mesh_term>
<mesh_term>Infarction</mesh_term>
</condition_browse>
<intervention_browse>
<!-- CAUTION: The following MeSH terms are assigned with an imperfect algorithm -->
<mesh_term>Colchicine</mesh_term>
</intervention_browse>
<patient_data>
<sharing_ipd>No</sharing_ipd>
</patient_data>
<!-- Results have not yet been posted for this study -->
</clinical_study>

View File

@@ -1,704 +0,0 @@
{
"success": true,
"error": null,
"response": [
{
"loc": {
"long": 31.25,
"lat": 30.063
},
"interval": "day",
"place": {
"name": "cairo",
"state": "qh",
"country": "eg"
},
"periods": [
{
"timestamp": 1665032400,
"validTime": "2022-10-06T07:00:00+02:00",
"dateTimeISO": "2022-10-06T07:00:00+02:00",
"maxTempC": 32,
"maxTempF": 90,
"minTempC": 19,
"minTempF": 66,
"avgTempC": 25,
"avgTempF": 78,
"tempC": null,
"tempF": null,
"maxFeelslikeC": 32,
"maxFeelslikeF": 89,
"minFeelslikeC": 21,
"minFeelslikeF": 70,
"avgFeelslikeC": 26,
"avgFeelslikeF": 80,
"feelslikeC": 21,
"feelslikeF": 70,
"maxDewpointC": 17,
"maxDewpointF": 63,
"minDewpointC": 11,
"minDewpointF": 52,
"avgDewpointC": 14,
"avgDewpointF": 58,
"dewpointC": 17,
"dewpointF": 63,
"maxHumidity": 77,
"minHumidity": 29,
"humidity": 77,
"pop": 0,
"precipMM": 0,
"precipIN": 0,
"iceaccum": null,
"iceaccumMM": null,
"iceaccumIN": null,
"snowCM": 0,
"snowIN": 0,
"pressureMB": 1015,
"pressureIN": 29.97,
"windDir": "N",
"windDirDEG": 353,
"windSpeedKTS": 5,
"windSpeedKPH": 9,
"windSpeedMPH": 6,
"windGustKTS": 21,
"windGustKPH": 40,
"windGustMPH": 25,
"windDirMax": "NNW",
"windDirMaxDEG": 342,
"windSpeedMaxKTS": 9,
"windSpeedMaxKPH": 16,
"windSpeedMaxMPH": 10,
"windDirMin": "N",
"windDirMinDEG": 353,
"windSpeedMinKTS": 1,
"windSpeedMinKPH": 2,
"windSpeedMinMPH": 1,
"windDir80m": "N",
"windDir80mDEG": 11,
"windSpeed80mKTS": 12,
"windSpeed80mKPH": 22,
"windSpeed80mMPH": 13,
"windGust80mKTS": 22,
"windGust80mKPH": 41,
"windGust80mMPH": 25,
"windDirMax80m": "NNW",
"windDirMax80mDEG": 343,
"windSpeedMax80mKTS": 22,
"windSpeedMax80mKPH": 41,
"windSpeedMax80mMPH": 25,
"windDirMin80m": "E",
"windDirMin80mDEG": 95,
"windSpeedMin80mKTS": 8,
"windSpeedMin80mKPH": 15,
"windSpeedMin80mMPH": 10,
"sky": 22,
"cloudsCoded": "FW",
"weather": "Mostly Sunny",
"weatherCoded": [],
"weatherPrimary": "Mostly Sunny",
"weatherPrimaryCoded": "::FW",
"icon": "fair.png",
"visibilityKM": 24.135,
"visibilityMI": 15,
"uvi": 6,
"solradWM2": 5608,
"solradMinWM2": 0,
"solradMaxWM2": 778,
"isDay": true,
"maxCoverage": "",
"sunrise": 1665028274,
"sunset": 1665070502,
"sunriseISO": "2022-10-06T05:51:14+02:00",
"sunsetISO": "2022-10-06T17:35:02+02:00"
},
{
"timestamp": 1665118800,
"validTime": "2022-10-07T07:00:00+02:00",
"dateTimeISO": "2022-10-07T07:00:00+02:00",
"maxTempC": 30,
"maxTempF": 86,
"minTempC": 19,
"minTempF": 66,
"avgTempC": 24,
"avgTempF": 76,
"tempC": null,
"tempF": null,
"maxFeelslikeC": 29,
"maxFeelslikeF": 85,
"minFeelslikeC": 19,
"minFeelslikeF": 67,
"avgFeelslikeC": 24,
"avgFeelslikeF": 76,
"feelslikeC": 19,
"feelslikeF": 67,
"maxDewpointC": 15,
"maxDewpointF": 60,
"minDewpointC": 10,
"minDewpointF": 50,
"avgDewpointC": 12,
"avgDewpointF": 54,
"dewpointC": 15,
"dewpointF": 60,
"maxHumidity": 77,
"minHumidity": 30,
"humidity": 77,
"pop": 0,
"precipMM": 0,
"precipIN": 0,
"iceaccum": null,
"iceaccumMM": null,
"iceaccumIN": null,
"snowCM": 0,
"snowIN": 0,
"pressureMB": 1014,
"pressureIN": 29.95,
"windDir": "NW",
"windDirDEG": 325,
"windSpeedKTS": 1,
"windSpeedKPH": 2,
"windSpeedMPH": 1,
"windGustKTS": 16,
"windGustKPH": 29,
"windGustMPH": 18,
"windDirMax": "WNW",
"windDirMaxDEG": 298,
"windSpeedMaxKTS": 7,
"windSpeedMaxKPH": 13,
"windSpeedMaxMPH": 8,
"windDirMin": "NW",
"windDirMinDEG": 325,
"windSpeedMinKTS": 1,
"windSpeedMinKPH": 2,
"windSpeedMinMPH": 1,
"windDir80m": "NNW",
"windDir80mDEG": 347,
"windSpeed80mKTS": 6,
"windSpeed80mKPH": 10,
"windSpeed80mMPH": 6,
"windGust80mKTS": 20,
"windGust80mKPH": 37,
"windGust80mMPH": 23,
"windDirMax80m": "NW",
"windDirMax80mDEG": 316,
"windSpeedMax80mKTS": 20,
"windSpeedMax80mKPH": 37,
"windSpeedMax80mMPH": 23,
"windDirMin80m": "NNW",
"windDirMin80mDEG": 347,
"windSpeedMin80mKTS": 6,
"windSpeedMin80mKPH": 10,
"windSpeedMin80mMPH": 6,
"sky": 30,
"cloudsCoded": "FW",
"weather": "Mostly Sunny",
"weatherCoded": [],
"weatherPrimary": "Mostly Sunny",
"weatherPrimaryCoded": "::FW",
"icon": "fair.png",
"visibilityKM": 24.135,
"visibilityMI": 15,
"uvi": 6,
"solradWM2": 5486,
"solradMinWM2": 0,
"solradMaxWM2": 742,
"isDay": true,
"maxCoverage": "",
"sunrise": 1665114710,
"sunset": 1665156831,
"sunriseISO": "2022-10-07T05:51:50+02:00",
"sunsetISO": "2022-10-07T17:33:51+02:00"
},
{
"timestamp": 1665205200,
"validTime": "2022-10-08T07:00:00+02:00",
"dateTimeISO": "2022-10-08T07:00:00+02:00",
"maxTempC": 30,
"maxTempF": 87,
"minTempC": 19,
"minTempF": 66,
"avgTempC": 25,
"avgTempF": 76,
"tempC": null,
"tempF": null,
"maxFeelslikeC": 30,
"maxFeelslikeF": 86,
"minFeelslikeC": 19,
"minFeelslikeF": 67,
"avgFeelslikeC": 25,
"avgFeelslikeF": 76,
"feelslikeC": 19,
"feelslikeF": 67,
"maxDewpointC": 15,
"maxDewpointF": 59,
"minDewpointC": 11,
"minDewpointF": 52,
"avgDewpointC": 13,
"avgDewpointF": 56,
"dewpointC": 15,
"dewpointF": 59,
"maxHumidity": 76,
"minHumidity": 32,
"humidity": 76,
"pop": 0,
"precipMM": 0,
"precipIN": 0,
"iceaccum": null,
"iceaccumMM": null,
"iceaccumIN": null,
"snowCM": 0,
"snowIN": 0,
"pressureMB": 1014,
"pressureIN": 29.94,
"windDir": "NNE",
"windDirDEG": 21,
"windSpeedKTS": 1,
"windSpeedKPH": 2,
"windSpeedMPH": 1,
"windGustKTS": 17,
"windGustKPH": 32,
"windGustMPH": 20,
"windDirMax": "WNW",
"windDirMaxDEG": 301,
"windSpeedMaxKTS": 7,
"windSpeedMaxKPH": 13,
"windSpeedMaxMPH": 8,
"windDirMin": "NNE",
"windDirMinDEG": 21,
"windSpeedMinKTS": 1,
"windSpeedMinKPH": 2,
"windSpeedMinMPH": 1,
"windDir80m": "NW",
"windDir80mDEG": 309,
"windSpeed80mKTS": 5,
"windSpeed80mKPH": 9,
"windSpeed80mMPH": 5,
"windGust80mKTS": 17,
"windGust80mKPH": 31,
"windGust80mMPH": 19,
"windDirMax80m": "NW",
"windDirMax80mDEG": 322,
"windSpeedMax80mKTS": 17,
"windSpeedMax80mKPH": 31,
"windSpeedMax80mMPH": 19,
"windDirMin80m": "NW",
"windDirMin80mDEG": 309,
"windSpeedMin80mKTS": 5,
"windSpeedMin80mKPH": 9,
"windSpeedMin80mMPH": 5,
"sky": 47,
"cloudsCoded": "SC",
"weather": "Partly Cloudy",
"weatherCoded": [],
"weatherPrimary": "Partly Cloudy",
"weatherPrimaryCoded": "::SC",
"icon": "pcloudy.png",
"visibilityKM": 24.135,
"visibilityMI": 15,
"uvi": 7,
"solradWM2": 4785,
"solradMinWM2": 0,
"solradMaxWM2": 682,
"isDay": true,
"maxCoverage": "",
"sunrise": 1665201146,
"sunset": 1665243161,
"sunriseISO": "2022-10-08T05:52:26+02:00",
"sunsetISO": "2022-10-08T17:32:41+02:00"
},
{
"timestamp": 1665291600,
"validTime": "2022-10-09T07:00:00+02:00",
"dateTimeISO": "2022-10-09T07:00:00+02:00",
"maxTempC": 31,
"maxTempF": 87,
"minTempC": 19,
"minTempF": 67,
"avgTempC": 25,
"avgTempF": 77,
"tempC": null,
"tempF": null,
"maxFeelslikeC": 30,
"maxFeelslikeF": 86,
"minFeelslikeC": 20,
"minFeelslikeF": 67,
"avgFeelslikeC": 25,
"avgFeelslikeF": 77,
"feelslikeC": 20,
"feelslikeF": 67,
"maxDewpointC": 17,
"maxDewpointF": 63,
"minDewpointC": 11,
"minDewpointF": 52,
"avgDewpointC": 14,
"avgDewpointF": 57,
"dewpointC": 17,
"dewpointF": 63,
"maxHumidity": 86,
"minHumidity": 31,
"humidity": 86,
"pop": 0,
"precipMM": 0,
"precipIN": 0,
"iceaccum": null,
"iceaccumMM": null,
"iceaccumIN": null,
"snowCM": 0,
"snowIN": 0,
"pressureMB": 1016,
"pressureIN": 29.99,
"windDir": "N",
"windDirDEG": 356,
"windSpeedKTS": 2,
"windSpeedKPH": 4,
"windSpeedMPH": 2,
"windGustKTS": 19,
"windGustKPH": 36,
"windGustMPH": 22,
"windDirMax": "NNW",
"windDirMaxDEG": 343,
"windSpeedMaxKTS": 8,
"windSpeedMaxKPH": 14,
"windSpeedMaxMPH": 9,
"windDirMin": "N",
"windDirMinDEG": 356,
"windSpeedMinKTS": 2,
"windSpeedMinKPH": 4,
"windSpeedMinMPH": 2,
"windDir80m": "NW",
"windDir80mDEG": 316,
"windSpeed80mKTS": 5,
"windSpeed80mKPH": 9,
"windSpeed80mMPH": 6,
"windGust80mKTS": 20,
"windGust80mKPH": 36,
"windGust80mMPH": 23,
"windDirMax80m": "N",
"windDirMax80mDEG": 354,
"windSpeedMax80mKTS": 20,
"windSpeedMax80mKPH": 36,
"windSpeedMax80mMPH": 23,
"windDirMin80m": "NW",
"windDirMin80mDEG": 316,
"windSpeedMin80mKTS": 5,
"windSpeedMin80mKPH": 9,
"windSpeedMin80mMPH": 6,
"sky": 47,
"cloudsCoded": "SC",
"weather": "Partly Cloudy",
"weatherCoded": [],
"weatherPrimary": "Partly Cloudy",
"weatherPrimaryCoded": "::SC",
"icon": "pcloudy.png",
"visibilityKM": 24.135,
"visibilityMI": 15,
"uvi": 7,
"solradWM2": 4768,
"solradMinWM2": 0,
"solradMaxWM2": 726,
"isDay": true,
"maxCoverage": "",
"sunrise": 1665287583,
"sunset": 1665329491,
"sunriseISO": "2022-10-09T05:53:03+02:00",
"sunsetISO": "2022-10-09T17:31:31+02:00"
},
{
"timestamp": 1665378000,
"validTime": "2022-10-10T07:00:00+02:00",
"dateTimeISO": "2022-10-10T07:00:00+02:00",
"maxTempC": 31,
"maxTempF": 87,
"minTempC": 21,
"minTempF": 70,
"avgTempC": 26,
"avgTempF": 78,
"tempC": null,
"tempF": null,
"maxFeelslikeC": 30,
"maxFeelslikeF": 86,
"minFeelslikeC": 21,
"minFeelslikeF": 69,
"avgFeelslikeC": 25,
"avgFeelslikeF": 78,
"feelslikeC": 21,
"feelslikeF": 69,
"maxDewpointC": 16,
"maxDewpointF": 61,
"minDewpointC": 13,
"minDewpointF": 55,
"avgDewpointC": 14,
"avgDewpointF": 58,
"dewpointC": 16,
"dewpointF": 61,
"maxHumidity": 75,
"minHumidity": 35,
"humidity": 75,
"pop": 0,
"precipMM": 0,
"precipIN": 0,
"iceaccum": null,
"iceaccumMM": null,
"iceaccumIN": null,
"snowCM": 0,
"snowIN": 0,
"pressureMB": 1017,
"pressureIN": 30.03,
"windDir": "N",
"windDirDEG": 358,
"windSpeedKTS": 2,
"windSpeedKPH": 4,
"windSpeedMPH": 2,
"windGustKTS": 16,
"windGustKPH": 30,
"windGustMPH": 19,
"windDirMax": "N",
"windDirMaxDEG": 10,
"windSpeedMaxKTS": 8,
"windSpeedMaxKPH": 15,
"windSpeedMaxMPH": 9,
"windDirMin": "N",
"windDirMinDEG": 358,
"windSpeedMinKTS": 2,
"windSpeedMinKPH": 4,
"windSpeedMinMPH": 2,
"windDir80m": "N",
"windDir80mDEG": 8,
"windSpeed80mKTS": 7,
"windSpeed80mKPH": 13,
"windSpeed80mMPH": 8,
"windGust80mKTS": 19,
"windGust80mKPH": 36,
"windGust80mMPH": 22,
"windDirMax80m": "N",
"windDirMax80mDEG": 10,
"windSpeedMax80mKTS": 19,
"windSpeedMax80mKPH": 36,
"windSpeedMax80mMPH": 22,
"windDirMin80m": "E",
"windDirMin80mDEG": 91,
"windSpeedMin80mKTS": 7,
"windSpeedMin80mKPH": 13,
"windSpeedMin80mMPH": 8,
"sky": 64,
"cloudsCoded": "SC",
"weather": "Partly Cloudy",
"weatherCoded": [],
"weatherPrimary": "Partly Cloudy",
"weatherPrimaryCoded": "::SC",
"icon": "pcloudy.png",
"visibilityKM": 24.135,
"visibilityMI": 15,
"uvi": 6,
"solradWM2": 4494,
"solradMinWM2": 0,
"solradMaxWM2": 597,
"isDay": true,
"maxCoverage": "",
"sunrise": 1665374020,
"sunset": 1665415821,
"sunriseISO": "2022-10-10T05:53:40+02:00",
"sunsetISO": "2022-10-10T17:30:21+02:00"
},
{
"timestamp": 1665464400,
"validTime": "2022-10-11T07:00:00+02:00",
"dateTimeISO": "2022-10-11T07:00:00+02:00",
"maxTempC": 31,
"maxTempF": 87,
"minTempC": 21,
"minTempF": 70,
"avgTempC": 26,
"avgTempF": 78,
"tempC": null,
"tempF": null,
"maxFeelslikeC": 31,
"maxFeelslikeF": 87,
"minFeelslikeC": 22,
"minFeelslikeF": 72,
"avgFeelslikeC": 26,
"avgFeelslikeF": 79,
"feelslikeC": 22,
"feelslikeF": 72,
"maxDewpointC": 17,
"maxDewpointF": 62,
"minDewpointC": 11,
"minDewpointF": 51,
"avgDewpointC": 13,
"avgDewpointF": 55,
"dewpointC": 17,
"dewpointF": 62,
"maxHumidity": 71,
"minHumidity": 30,
"humidity": 71,
"pop": 0,
"precipMM": 0,
"precipIN": 0,
"iceaccum": null,
"iceaccumMM": null,
"iceaccumIN": null,
"snowCM": 0,
"snowIN": 0,
"pressureMB": 1015,
"pressureIN": 29.98,
"windDir": "NNE",
"windDirDEG": 13,
"windSpeedKTS": 8,
"windSpeedKPH": 15,
"windSpeedMPH": 9,
"windGustKTS": 15,
"windGustKPH": 28,
"windGustMPH": 17,
"windDirMax": "NNE",
"windDirMaxDEG": 28,
"windSpeedMaxKTS": 15,
"windSpeedMaxKPH": 28,
"windSpeedMaxMPH": 18,
"windDirMin": "NNE",
"windDirMinDEG": 14,
"windSpeedMinKTS": 7,
"windSpeedMinKPH": 14,
"windSpeedMinMPH": 8,
"windDir80m": "NNE",
"windDir80mDEG": 16,
"windSpeed80mKTS": 10,
"windSpeed80mKPH": 19,
"windSpeed80mMPH": 12,
"windGust80mKTS": 17,
"windGust80mKPH": 31,
"windGust80mMPH": 19,
"windDirMax80m": "NNE",
"windDirMax80mDEG": 28,
"windSpeedMax80mKTS": 17,
"windSpeedMax80mKPH": 31,
"windSpeedMax80mMPH": 19,
"windDirMin80m": "NNE",
"windDirMin80mDEG": 13,
"windSpeedMin80mKTS": 9,
"windSpeedMin80mKPH": 18,
"windSpeedMin80mMPH": 11,
"sky": 0,
"cloudsCoded": "CL",
"weather": "Sunny",
"weatherCoded": [],
"weatherPrimary": "Sunny",
"weatherPrimaryCoded": "::CL",
"icon": "sunny.png",
"visibilityKM": 24.135,
"visibilityMI": 15,
"uvi": null,
"solradWM2": 5450,
"solradMinWM2": 0,
"solradMaxWM2": 758,
"isDay": true,
"maxCoverage": "",
"sunrise": 1665460458,
"sunset": 1665502153,
"sunriseISO": "2022-10-11T05:54:18+02:00",
"sunsetISO": "2022-10-11T17:29:13+02:00"
},
{
"timestamp": 1665550800,
"validTime": "2022-10-12T07:00:00+02:00",
"dateTimeISO": "2022-10-12T07:00:00+02:00",
"maxTempC": 31,
"maxTempF": 88,
"minTempC": 21,
"minTempF": 69,
"avgTempC": 26,
"avgTempF": 79,
"tempC": null,
"tempF": null,
"maxFeelslikeC": 31,
"maxFeelslikeF": 88,
"minFeelslikeC": 22,
"minFeelslikeF": 72,
"avgFeelslikeC": 26,
"avgFeelslikeF": 80,
"feelslikeC": 22,
"feelslikeF": 72,
"maxDewpointC": 16,
"maxDewpointF": 60,
"minDewpointC": 11,
"minDewpointF": 51,
"avgDewpointC": 13,
"avgDewpointF": 55,
"dewpointC": 16,
"dewpointF": 60,
"maxHumidity": 68,
"minHumidity": 29,
"humidity": 68,
"pop": 0,
"precipMM": 0,
"precipIN": 0,
"iceaccum": null,
"iceaccumMM": null,
"iceaccumIN": null,
"snowCM": 0,
"snowIN": 0,
"pressureMB": 1014,
"pressureIN": 29.95,
"windDir": "NNE",
"windDirDEG": 12,
"windSpeedKTS": 8,
"windSpeedKPH": 15,
"windSpeedMPH": 9,
"windGustKTS": 15,
"windGustKPH": 28,
"windGustMPH": 17,
"windDirMax": "E",
"windDirMaxDEG": 96,
"windSpeedMaxKTS": 14,
"windSpeedMaxKPH": 26,
"windSpeedMaxMPH": 16,
"windDirMin": "NNE",
"windDirMinDEG": 12,
"windSpeedMinKTS": 7,
"windSpeedMinKPH": 13,
"windSpeedMinMPH": 8,
"windDir80m": "NNE",
"windDir80mDEG": 15,
"windSpeed80mKTS": 10,
"windSpeed80mKPH": 19,
"windSpeed80mMPH": 12,
"windGust80mKTS": 18,
"windGust80mKPH": 33,
"windGust80mMPH": 21,
"windDirMax80m": "E",
"windDirMax80mDEG": 96,
"windSpeedMax80mKTS": 18,
"windSpeedMax80mKPH": 33,
"windSpeedMax80mMPH": 21,
"windDirMin80m": "NNE",
"windDirMin80mDEG": 15,
"windSpeedMin80mKTS": 10,
"windSpeedMin80mKPH": 18,
"windSpeedMin80mMPH": 11,
"sky": 27,
"cloudsCoded": "FW",
"weather": "Mostly Sunny",
"weatherCoded": [],
"weatherPrimary": "Mostly Sunny",
"weatherPrimaryCoded": "::FW",
"icon": "fair.png",
"visibilityKM": 24.135,
"visibilityMI": 15,
"uvi": null,
"solradWM2": 4740,
"solradMinWM2": 0,
"solradMaxWM2": 743,
"isDay": true,
"maxCoverage": "",
"sunrise": 1665546895,
"sunset": 1665588484,
"sunriseISO": "2022-10-12T05:54:55+02:00",
"sunsetISO": "2022-10-12T17:28:04+02:00"
}
],
"profile": {
"tz": "Africa/Cairo",
"elevM": 23,
"elevFT": 75
}
}
]
}

View File

@@ -1,691 +0,0 @@
<success>true</success>
<response>
<loc>
<long>31.25</long>
<lat>30.063</lat>
</loc>
<profile>
<elevM>23</elevM>
<tz>Africa/Cairo</tz>
<elevFT>75</elevFT>
</profile>
<periods>
<dateTimeISO>2022-10-06T07:00:00+02:00</dateTimeISO>
<windDirMin80m>E</windDirMin80m>
<windDirMin80mDEG>95</windDirMin80mDEG>
<feelslikeC>21</feelslikeC>
<visibilityMI>15</visibilityMI>
<windSpeedMaxMPH>10</windSpeedMaxMPH>
<windDirDEG>353</windDirDEG>
<windDir>N</windDir>
<sunriseISO>2022-10-06T05:51:14+02:00</sunriseISO>
<iceaccumMM>null</iceaccumMM>
<windSpeedMaxKTS>9</windSpeedMaxKTS>
<iceaccumIN>null</iceaccumIN>
<minTempF>66</minTempF>
<snowIN>0</snowIN>
<weather>Mostly Sunny</weather>
<sunsetISO>2022-10-06T17:35:02+02:00</sunsetISO>
<maxFeelslikeC>32</maxFeelslikeC>
<humidity>77</humidity>
<windDir80m>N</windDir80m>
<maxFeelslikeF>89</maxFeelslikeF>
<precipMM>0</precipMM>
<sky>22</sky>
<windGust80mMPH>25</windGust80mMPH>
<windSpeedMax80mMPH>25</windSpeedMax80mMPH>
<weatherPrimary>Mostly Sunny</weatherPrimary>
<windGust80mKPH>41</windGust80mKPH>
<avgDewpointF>58</avgDewpointF>
<windSpeedMax80mKPH>41</windSpeedMax80mKPH>
<windGust80mKTS>22</windGust80mKTS>
<avgDewpointC>14</avgDewpointC>
<precipIN>0</precipIN>
<windSpeedMax80mKTS>22</windSpeedMax80mKTS>
<windDirMinDEG>353</windDirMinDEG>
<windSpeedMaxKPH>16</windSpeedMaxKPH>
<windSpeedMin80mKTS>8</windSpeedMin80mKTS>
<feelslikeF>70</feelslikeF>
<validTime>2022-10-06T07:00:00+02:00</validTime>
<windSpeedMin80mMPH>10</windSpeedMin80mMPH>
<solradMaxWM2>778</solradMaxWM2>
<avgTempC>25</avgTempC>
<windSpeedMin80mKPH>15</windSpeedMin80mKPH>
<weatherPrimaryCoded>::FW</weatherPrimaryCoded>
<sunrise>1665028274</sunrise>
<avgTempF>78</avgTempF>
<windDirMin>N</windDirMin>
<maxCoverage/>
<icon>fair.png</icon>
<minFeelslikeC>21</minFeelslikeC>
<dewpointC>17</dewpointC>
<cloudsCoded>FW</cloudsCoded>
<minFeelslikeF>70</minFeelslikeF>
<minHumidity>29</minHumidity>
<dewpointF>63</dewpointF>
<windSpeed80mKTS>12</windSpeed80mKTS>
<pop>0</pop>
<snowCM>0</snowCM>
<windDirMax>NNW</windDirMax>
<windSpeed80mMPH>13</windSpeed80mMPH>
<windSpeed80mKPH>22</windSpeed80mKPH>
<windDir80mDEG>11</windDir80mDEG>
<maxTempC>32</maxTempC>
<pressureMB>1015</pressureMB>
<visibilityKM>24.135</visibilityKM>
<timestamp>1665032400</timestamp>
<maxTempF>90</maxTempF>
<tempF>null</tempF>
<minDewpointC>11</minDewpointC>
<solradMinWM2>0</solradMinWM2>
<windSpeedMinKTS>1</windSpeedMinKTS>
<windDirMax80mDEG>343</windDirMax80mDEG>
<windGustKTS>21</windGustKTS>
<windSpeedMinKPH>2</windSpeedMinKPH>
<maxDewpointF>63</maxDewpointF>
<windSpeedMinMPH>1</windSpeedMinMPH>
<avgFeelslikeC>26</avgFeelslikeC>
<uvi>6</uvi>
<windDirMax80m>NNW</windDirMax80m>
<maxDewpointC>17</maxDewpointC>
<pressureIN>29.97</pressureIN>
<avgFeelslikeF>80</avgFeelslikeF>
<iceaccum>null</iceaccum>
<isDay>true</isDay>
<minTempC>19</minTempC>
<minDewpointF>52</minDewpointF>
<windSpeedKTS>5</windSpeedKTS>
<sunset>1665070502</sunset>
<solradWM2>5608</solradWM2>
<windSpeedKPH>9</windSpeedKPH>
<windGustMPH>25</windGustMPH>
<maxHumidity>77</maxHumidity>
<windSpeedMPH>6</windSpeedMPH>
<windGustKPH>40</windGustKPH>
<windDirMaxDEG>342</windDirMaxDEG>
<tempC>null</tempC>
</periods>
<periods>
<dateTimeISO>2022-10-07T07:00:00+02:00</dateTimeISO>
<windDirMin80m>NNW</windDirMin80m>
<windDirMin80mDEG>347</windDirMin80mDEG>
<feelslikeC>19</feelslikeC>
<visibilityMI>15</visibilityMI>
<windSpeedMaxMPH>8</windSpeedMaxMPH>
<windDirDEG>325</windDirDEG>
<windDir>NW</windDir>
<sunriseISO>2022-10-07T05:51:50+02:00</sunriseISO>
<iceaccumMM>null</iceaccumMM>
<windSpeedMaxKTS>7</windSpeedMaxKTS>
<iceaccumIN>null</iceaccumIN>
<minTempF>66</minTempF>
<snowIN>0</snowIN>
<weather>Mostly Sunny</weather>
<sunsetISO>2022-10-07T17:33:51+02:00</sunsetISO>
<maxFeelslikeC>29</maxFeelslikeC>
<humidity>77</humidity>
<windDir80m>NNW</windDir80m>
<maxFeelslikeF>85</maxFeelslikeF>
<precipMM>0</precipMM>
<sky>30</sky>
<windGust80mMPH>23</windGust80mMPH>
<windSpeedMax80mMPH>23</windSpeedMax80mMPH>
<weatherPrimary>Mostly Sunny</weatherPrimary>
<windGust80mKPH>37</windGust80mKPH>
<avgDewpointF>54</avgDewpointF>
<windSpeedMax80mKPH>37</windSpeedMax80mKPH>
<windGust80mKTS>20</windGust80mKTS>
<avgDewpointC>12</avgDewpointC>
<precipIN>0</precipIN>
<windSpeedMax80mKTS>20</windSpeedMax80mKTS>
<windDirMinDEG>325</windDirMinDEG>
<windSpeedMaxKPH>13</windSpeedMaxKPH>
<windSpeedMin80mKTS>6</windSpeedMin80mKTS>
<feelslikeF>67</feelslikeF>
<validTime>2022-10-07T07:00:00+02:00</validTime>
<windSpeedMin80mMPH>6</windSpeedMin80mMPH>
<solradMaxWM2>742</solradMaxWM2>
<avgTempC>24</avgTempC>
<windSpeedMin80mKPH>10</windSpeedMin80mKPH>
<weatherPrimaryCoded>::FW</weatherPrimaryCoded>
<sunrise>1665114710</sunrise>
<avgTempF>76</avgTempF>
<windDirMin>NW</windDirMin>
<maxCoverage/>
<icon>fair.png</icon>
<minFeelslikeC>19</minFeelslikeC>
<dewpointC>15</dewpointC>
<cloudsCoded>FW</cloudsCoded>
<minFeelslikeF>67</minFeelslikeF>
<minHumidity>30</minHumidity>
<dewpointF>60</dewpointF>
<windSpeed80mKTS>6</windSpeed80mKTS>
<pop>0</pop>
<snowCM>0</snowCM>
<windDirMax>WNW</windDirMax>
<windSpeed80mMPH>6</windSpeed80mMPH>
<windSpeed80mKPH>10</windSpeed80mKPH>
<windDir80mDEG>347</windDir80mDEG>
<maxTempC>30</maxTempC>
<pressureMB>1014</pressureMB>
<visibilityKM>24.135</visibilityKM>
<timestamp>1665118800</timestamp>
<maxTempF>86</maxTempF>
<tempF>null</tempF>
<minDewpointC>10</minDewpointC>
<solradMinWM2>0</solradMinWM2>
<windSpeedMinKTS>1</windSpeedMinKTS>
<windDirMax80mDEG>316</windDirMax80mDEG>
<windGustKTS>16</windGustKTS>
<windSpeedMinKPH>2</windSpeedMinKPH>
<maxDewpointF>60</maxDewpointF>
<windSpeedMinMPH>1</windSpeedMinMPH>
<avgFeelslikeC>24</avgFeelslikeC>
<uvi>6</uvi>
<windDirMax80m>NW</windDirMax80m>
<maxDewpointC>15</maxDewpointC>
<pressureIN>29.95</pressureIN>
<avgFeelslikeF>76</avgFeelslikeF>
<iceaccum>null</iceaccum>
<isDay>true</isDay>
<minTempC>19</minTempC>
<minDewpointF>50</minDewpointF>
<windSpeedKTS>1</windSpeedKTS>
<sunset>1665156831</sunset>
<solradWM2>5486</solradWM2>
<windSpeedKPH>2</windSpeedKPH>
<windGustMPH>18</windGustMPH>
<maxHumidity>77</maxHumidity>
<windSpeedMPH>1</windSpeedMPH>
<windGustKPH>29</windGustKPH>
<windDirMaxDEG>298</windDirMaxDEG>
<tempC>null</tempC>
</periods>
<periods>
<dateTimeISO>2022-10-08T07:00:00+02:00</dateTimeISO>
<windDirMin80m>NW</windDirMin80m>
<windDirMin80mDEG>309</windDirMin80mDEG>
<feelslikeC>19</feelslikeC>
<visibilityMI>15</visibilityMI>
<windSpeedMaxMPH>8</windSpeedMaxMPH>
<windDirDEG>21</windDirDEG>
<windDir>NNE</windDir>
<sunriseISO>2022-10-08T05:52:26+02:00</sunriseISO>
<iceaccumMM>null</iceaccumMM>
<windSpeedMaxKTS>7</windSpeedMaxKTS>
<iceaccumIN>null</iceaccumIN>
<minTempF>66</minTempF>
<snowIN>0</snowIN>
<weather>Partly Cloudy</weather>
<sunsetISO>2022-10-08T17:32:41+02:00</sunsetISO>
<maxFeelslikeC>30</maxFeelslikeC>
<humidity>76</humidity>
<windDir80m>NW</windDir80m>
<maxFeelslikeF>86</maxFeelslikeF>
<precipMM>0</precipMM>
<sky>47</sky>
<windGust80mMPH>19</windGust80mMPH>
<windSpeedMax80mMPH>19</windSpeedMax80mMPH>
<weatherPrimary>Partly Cloudy</weatherPrimary>
<windGust80mKPH>31</windGust80mKPH>
<avgDewpointF>56</avgDewpointF>
<windSpeedMax80mKPH>31</windSpeedMax80mKPH>
<windGust80mKTS>17</windGust80mKTS>
<avgDewpointC>13</avgDewpointC>
<precipIN>0</precipIN>
<windSpeedMax80mKTS>17</windSpeedMax80mKTS>
<windDirMinDEG>21</windDirMinDEG>
<windSpeedMaxKPH>13</windSpeedMaxKPH>
<windSpeedMin80mKTS>5</windSpeedMin80mKTS>
<feelslikeF>67</feelslikeF>
<validTime>2022-10-08T07:00:00+02:00</validTime>
<windSpeedMin80mMPH>5</windSpeedMin80mMPH>
<solradMaxWM2>682</solradMaxWM2>
<avgTempC>25</avgTempC>
<windSpeedMin80mKPH>9</windSpeedMin80mKPH>
<weatherPrimaryCoded>::SC</weatherPrimaryCoded>
<sunrise>1665201146</sunrise>
<avgTempF>76</avgTempF>
<windDirMin>NNE</windDirMin>
<maxCoverage/>
<icon>pcloudy.png</icon>
<minFeelslikeC>19</minFeelslikeC>
<dewpointC>15</dewpointC>
<cloudsCoded>SC</cloudsCoded>
<minFeelslikeF>67</minFeelslikeF>
<minHumidity>32</minHumidity>
<dewpointF>59</dewpointF>
<windSpeed80mKTS>5</windSpeed80mKTS>
<pop>0</pop>
<snowCM>0</snowCM>
<windDirMax>WNW</windDirMax>
<windSpeed80mMPH>5</windSpeed80mMPH>
<windSpeed80mKPH>9</windSpeed80mKPH>
<windDir80mDEG>309</windDir80mDEG>
<maxTempC>30</maxTempC>
<pressureMB>1014</pressureMB>
<visibilityKM>24.135</visibilityKM>
<timestamp>1665205200</timestamp>
<maxTempF>87</maxTempF>
<tempF>null</tempF>
<minDewpointC>11</minDewpointC>
<solradMinWM2>0</solradMinWM2>
<windSpeedMinKTS>1</windSpeedMinKTS>
<windDirMax80mDEG>322</windDirMax80mDEG>
<windGustKTS>17</windGustKTS>
<windSpeedMinKPH>2</windSpeedMinKPH>
<maxDewpointF>59</maxDewpointF>
<windSpeedMinMPH>1</windSpeedMinMPH>
<avgFeelslikeC>25</avgFeelslikeC>
<uvi>7</uvi>
<windDirMax80m>NW</windDirMax80m>
<maxDewpointC>15</maxDewpointC>
<pressureIN>29.94</pressureIN>
<avgFeelslikeF>76</avgFeelslikeF>
<iceaccum>null</iceaccum>
<isDay>true</isDay>
<minTempC>19</minTempC>
<minDewpointF>52</minDewpointF>
<windSpeedKTS>1</windSpeedKTS>
<sunset>1665243161</sunset>
<solradWM2>4785</solradWM2>
<windSpeedKPH>2</windSpeedKPH>
<windGustMPH>20</windGustMPH>
<maxHumidity>76</maxHumidity>
<windSpeedMPH>1</windSpeedMPH>
<windGustKPH>32</windGustKPH>
<windDirMaxDEG>301</windDirMaxDEG>
<tempC>null</tempC>
</periods>
<periods>
<dateTimeISO>2022-10-09T07:00:00+02:00</dateTimeISO>
<windDirMin80m>NW</windDirMin80m>
<windDirMin80mDEG>316</windDirMin80mDEG>
<feelslikeC>20</feelslikeC>
<visibilityMI>15</visibilityMI>
<windSpeedMaxMPH>9</windSpeedMaxMPH>
<windDirDEG>356</windDirDEG>
<windDir>N</windDir>
<sunriseISO>2022-10-09T05:53:03+02:00</sunriseISO>
<iceaccumMM>null</iceaccumMM>
<windSpeedMaxKTS>8</windSpeedMaxKTS>
<iceaccumIN>null</iceaccumIN>
<minTempF>67</minTempF>
<snowIN>0</snowIN>
<weather>Partly Cloudy</weather>
<sunsetISO>2022-10-09T17:31:31+02:00</sunsetISO>
<maxFeelslikeC>30</maxFeelslikeC>
<humidity>86</humidity>
<windDir80m>NW</windDir80m>
<maxFeelslikeF>86</maxFeelslikeF>
<precipMM>0</precipMM>
<sky>47</sky>
<windGust80mMPH>23</windGust80mMPH>
<windSpeedMax80mMPH>23</windSpeedMax80mMPH>
<weatherPrimary>Partly Cloudy</weatherPrimary>
<windGust80mKPH>36</windGust80mKPH>
<avgDewpointF>57</avgDewpointF>
<windSpeedMax80mKPH>36</windSpeedMax80mKPH>
<windGust80mKTS>20</windGust80mKTS>
<avgDewpointC>14</avgDewpointC>
<precipIN>0</precipIN>
<windSpeedMax80mKTS>20</windSpeedMax80mKTS>
<windDirMinDEG>356</windDirMinDEG>
<windSpeedMaxKPH>14</windSpeedMaxKPH>
<windSpeedMin80mKTS>5</windSpeedMin80mKTS>
<feelslikeF>67</feelslikeF>
<validTime>2022-10-09T07:00:00+02:00</validTime>
<windSpeedMin80mMPH>6</windSpeedMin80mMPH>
<solradMaxWM2>726</solradMaxWM2>
<avgTempC>25</avgTempC>
<windSpeedMin80mKPH>9</windSpeedMin80mKPH>
<weatherPrimaryCoded>::SC</weatherPrimaryCoded>
<sunrise>1665287583</sunrise>
<avgTempF>77</avgTempF>
<windDirMin>N</windDirMin>
<maxCoverage/>
<icon>pcloudy.png</icon>
<minFeelslikeC>20</minFeelslikeC>
<dewpointC>17</dewpointC>
<cloudsCoded>SC</cloudsCoded>
<minFeelslikeF>67</minFeelslikeF>
<minHumidity>31</minHumidity>
<dewpointF>63</dewpointF>
<windSpeed80mKTS>5</windSpeed80mKTS>
<pop>0</pop>
<snowCM>0</snowCM>
<windDirMax>NNW</windDirMax>
<windSpeed80mMPH>6</windSpeed80mMPH>
<windSpeed80mKPH>9</windSpeed80mKPH>
<windDir80mDEG>316</windDir80mDEG>
<maxTempC>31</maxTempC>
<pressureMB>1016</pressureMB>
<visibilityKM>24.135</visibilityKM>
<timestamp>1665291600</timestamp>
<maxTempF>87</maxTempF>
<tempF>null</tempF>
<minDewpointC>11</minDewpointC>
<solradMinWM2>0</solradMinWM2>
<windSpeedMinKTS>2</windSpeedMinKTS>
<windDirMax80mDEG>354</windDirMax80mDEG>
<windGustKTS>19</windGustKTS>
<windSpeedMinKPH>4</windSpeedMinKPH>
<maxDewpointF>63</maxDewpointF>
<windSpeedMinMPH>2</windSpeedMinMPH>
<avgFeelslikeC>25</avgFeelslikeC>
<uvi>7</uvi>
<windDirMax80m>N</windDirMax80m>
<maxDewpointC>17</maxDewpointC>
<pressureIN>29.99</pressureIN>
<avgFeelslikeF>77</avgFeelslikeF>
<iceaccum>null</iceaccum>
<isDay>true</isDay>
<minTempC>19</minTempC>
<minDewpointF>52</minDewpointF>
<windSpeedKTS>2</windSpeedKTS>
<sunset>1665329491</sunset>
<solradWM2>4768</solradWM2>
<windSpeedKPH>4</windSpeedKPH>
<windGustMPH>22</windGustMPH>
<maxHumidity>86</maxHumidity>
<windSpeedMPH>2</windSpeedMPH>
<windGustKPH>36</windGustKPH>
<windDirMaxDEG>343</windDirMaxDEG>
<tempC>null</tempC>
</periods>
<periods>
<dateTimeISO>2022-10-10T07:00:00+02:00</dateTimeISO>
<windDirMin80m>E</windDirMin80m>
<windDirMin80mDEG>91</windDirMin80mDEG>
<feelslikeC>21</feelslikeC>
<visibilityMI>15</visibilityMI>
<windSpeedMaxMPH>9</windSpeedMaxMPH>
<windDirDEG>358</windDirDEG>
<windDir>N</windDir>
<sunriseISO>2022-10-10T05:53:40+02:00</sunriseISO>
<iceaccumMM>null</iceaccumMM>
<windSpeedMaxKTS>8</windSpeedMaxKTS>
<iceaccumIN>null</iceaccumIN>
<minTempF>70</minTempF>
<snowIN>0</snowIN>
<weather>Partly Cloudy</weather>
<sunsetISO>2022-10-10T17:30:21+02:00</sunsetISO>
<maxFeelslikeC>30</maxFeelslikeC>
<humidity>75</humidity>
<windDir80m>N</windDir80m>
<maxFeelslikeF>86</maxFeelslikeF>
<precipMM>0</precipMM>
<sky>64</sky>
<windGust80mMPH>22</windGust80mMPH>
<windSpeedMax80mMPH>22</windSpeedMax80mMPH>
<weatherPrimary>Partly Cloudy</weatherPrimary>
<windGust80mKPH>36</windGust80mKPH>
<avgDewpointF>58</avgDewpointF>
<windSpeedMax80mKPH>36</windSpeedMax80mKPH>
<windGust80mKTS>19</windGust80mKTS>
<avgDewpointC>14</avgDewpointC>
<precipIN>0</precipIN>
<windSpeedMax80mKTS>19</windSpeedMax80mKTS>
<windDirMinDEG>358</windDirMinDEG>
<windSpeedMaxKPH>15</windSpeedMaxKPH>
<windSpeedMin80mKTS>7</windSpeedMin80mKTS>
<feelslikeF>69</feelslikeF>
<validTime>2022-10-10T07:00:00+02:00</validTime>
<windSpeedMin80mMPH>8</windSpeedMin80mMPH>
<solradMaxWM2>597</solradMaxWM2>
<avgTempC>26</avgTempC>
<windSpeedMin80mKPH>13</windSpeedMin80mKPH>
<weatherPrimaryCoded>::SC</weatherPrimaryCoded>
<sunrise>1665374020</sunrise>
<avgTempF>78</avgTempF>
<windDirMin>N</windDirMin>
<maxCoverage/>
<icon>pcloudy.png</icon>
<minFeelslikeC>21</minFeelslikeC>
<dewpointC>16</dewpointC>
<cloudsCoded>SC</cloudsCoded>
<minFeelslikeF>69</minFeelslikeF>
<minHumidity>35</minHumidity>
<dewpointF>61</dewpointF>
<windSpeed80mKTS>7</windSpeed80mKTS>
<pop>0</pop>
<snowCM>0</snowCM>
<windDirMax>N</windDirMax>
<windSpeed80mMPH>8</windSpeed80mMPH>
<windSpeed80mKPH>13</windSpeed80mKPH>
<windDir80mDEG>8</windDir80mDEG>
<maxTempC>31</maxTempC>
<pressureMB>1017</pressureMB>
<visibilityKM>24.135</visibilityKM>
<timestamp>1665378000</timestamp>
<maxTempF>87</maxTempF>
<tempF>null</tempF>
<minDewpointC>13</minDewpointC>
<solradMinWM2>0</solradMinWM2>
<windSpeedMinKTS>2</windSpeedMinKTS>
<windDirMax80mDEG>10</windDirMax80mDEG>
<windGustKTS>16</windGustKTS>
<windSpeedMinKPH>4</windSpeedMinKPH>
<maxDewpointF>61</maxDewpointF>
<windSpeedMinMPH>2</windSpeedMinMPH>
<avgFeelslikeC>25</avgFeelslikeC>
<uvi>6</uvi>
<windDirMax80m>N</windDirMax80m>
<maxDewpointC>16</maxDewpointC>
<pressureIN>30.03</pressureIN>
<avgFeelslikeF>78</avgFeelslikeF>
<iceaccum>null</iceaccum>
<isDay>true</isDay>
<minTempC>21</minTempC>
<minDewpointF>55</minDewpointF>
<windSpeedKTS>2</windSpeedKTS>
<sunset>1665415821</sunset>
<solradWM2>4494</solradWM2>
<windSpeedKPH>4</windSpeedKPH>
<windGustMPH>19</windGustMPH>
<maxHumidity>75</maxHumidity>
<windSpeedMPH>2</windSpeedMPH>
<windGustKPH>30</windGustKPH>
<windDirMaxDEG>10</windDirMaxDEG>
<tempC>null</tempC>
</periods>
<periods>
<dateTimeISO>2022-10-11T07:00:00+02:00</dateTimeISO>
<windDirMin80m>NNE</windDirMin80m>
<windDirMin80mDEG>13</windDirMin80mDEG>
<feelslikeC>22</feelslikeC>
<visibilityMI>15</visibilityMI>
<windSpeedMaxMPH>18</windSpeedMaxMPH>
<windDirDEG>13</windDirDEG>
<windDir>NNE</windDir>
<sunriseISO>2022-10-11T05:54:18+02:00</sunriseISO>
<iceaccumMM>null</iceaccumMM>
<windSpeedMaxKTS>15</windSpeedMaxKTS>
<iceaccumIN>null</iceaccumIN>
<minTempF>70</minTempF>
<snowIN>0</snowIN>
<weather>Sunny</weather>
<sunsetISO>2022-10-11T17:29:13+02:00</sunsetISO>
<maxFeelslikeC>31</maxFeelslikeC>
<humidity>71</humidity>
<windDir80m>NNE</windDir80m>
<maxFeelslikeF>87</maxFeelslikeF>
<precipMM>0</precipMM>
<sky>0</sky>
<windGust80mMPH>19</windGust80mMPH>
<windSpeedMax80mMPH>19</windSpeedMax80mMPH>
<weatherPrimary>Sunny</weatherPrimary>
<windGust80mKPH>31</windGust80mKPH>
<avgDewpointF>55</avgDewpointF>
<windSpeedMax80mKPH>31</windSpeedMax80mKPH>
<windGust80mKTS>17</windGust80mKTS>
<avgDewpointC>13</avgDewpointC>
<precipIN>0</precipIN>
<windSpeedMax80mKTS>17</windSpeedMax80mKTS>
<windDirMinDEG>14</windDirMinDEG>
<windSpeedMaxKPH>28</windSpeedMaxKPH>
<windSpeedMin80mKTS>9</windSpeedMin80mKTS>
<feelslikeF>72</feelslikeF>
<validTime>2022-10-11T07:00:00+02:00</validTime>
<windSpeedMin80mMPH>11</windSpeedMin80mMPH>
<solradMaxWM2>758</solradMaxWM2>
<avgTempC>26</avgTempC>
<windSpeedMin80mKPH>18</windSpeedMin80mKPH>
<weatherPrimaryCoded>::CL</weatherPrimaryCoded>
<sunrise>1665460458</sunrise>
<avgTempF>78</avgTempF>
<windDirMin>NNE</windDirMin>
<maxCoverage/>
<icon>sunny.png</icon>
<minFeelslikeC>22</minFeelslikeC>
<dewpointC>17</dewpointC>
<cloudsCoded>CL</cloudsCoded>
<minFeelslikeF>72</minFeelslikeF>
<minHumidity>30</minHumidity>
<dewpointF>62</dewpointF>
<windSpeed80mKTS>10</windSpeed80mKTS>
<pop>0</pop>
<snowCM>0</snowCM>
<windDirMax>NNE</windDirMax>
<windSpeed80mMPH>12</windSpeed80mMPH>
<windSpeed80mKPH>19</windSpeed80mKPH>
<windDir80mDEG>16</windDir80mDEG>
<maxTempC>31</maxTempC>
<pressureMB>1015</pressureMB>
<visibilityKM>24.135</visibilityKM>
<timestamp>1665464400</timestamp>
<maxTempF>87</maxTempF>
<tempF>null</tempF>
<minDewpointC>11</minDewpointC>
<solradMinWM2>0</solradMinWM2>
<windSpeedMinKTS>7</windSpeedMinKTS>
<windDirMax80mDEG>28</windDirMax80mDEG>
<windGustKTS>15</windGustKTS>
<windSpeedMinKPH>14</windSpeedMinKPH>
<maxDewpointF>62</maxDewpointF>
<windSpeedMinMPH>8</windSpeedMinMPH>
<avgFeelslikeC>26</avgFeelslikeC>
<uvi>null</uvi>
<windDirMax80m>NNE</windDirMax80m>
<maxDewpointC>17</maxDewpointC>
<pressureIN>29.98</pressureIN>
<avgFeelslikeF>79</avgFeelslikeF>
<iceaccum>null</iceaccum>
<isDay>true</isDay>
<minTempC>21</minTempC>
<minDewpointF>51</minDewpointF>
<windSpeedKTS>8</windSpeedKTS>
<sunset>1665502153</sunset>
<solradWM2>5450</solradWM2>
<windSpeedKPH>15</windSpeedKPH>
<windGustMPH>17</windGustMPH>
<maxHumidity>71</maxHumidity>
<windSpeedMPH>9</windSpeedMPH>
<windGustKPH>28</windGustKPH>
<windDirMaxDEG>28</windDirMaxDEG>
<tempC>null</tempC>
</periods>
<periods>
<dateTimeISO>2022-10-12T07:00:00+02:00</dateTimeISO>
<windDirMin80m>NNE</windDirMin80m>
<windDirMin80mDEG>15</windDirMin80mDEG>
<feelslikeC>22</feelslikeC>
<visibilityMI>15</visibilityMI>
<windSpeedMaxMPH>16</windSpeedMaxMPH>
<windDirDEG>12</windDirDEG>
<windDir>NNE</windDir>
<sunriseISO>2022-10-12T05:54:55+02:00</sunriseISO>
<iceaccumMM>null</iceaccumMM>
<windSpeedMaxKTS>14</windSpeedMaxKTS>
<iceaccumIN>null</iceaccumIN>
<minTempF>69</minTempF>
<snowIN>0</snowIN>
<weather>Mostly Sunny</weather>
<sunsetISO>2022-10-12T17:28:04+02:00</sunsetISO>
<maxFeelslikeC>31</maxFeelslikeC>
<humidity>68</humidity>
<windDir80m>NNE</windDir80m>
<maxFeelslikeF>88</maxFeelslikeF>
<precipMM>0</precipMM>
<sky>27</sky>
<windGust80mMPH>21</windGust80mMPH>
<windSpeedMax80mMPH>21</windSpeedMax80mMPH>
<weatherPrimary>Mostly Sunny</weatherPrimary>
<windGust80mKPH>33</windGust80mKPH>
<avgDewpointF>55</avgDewpointF>
<windSpeedMax80mKPH>33</windSpeedMax80mKPH>
<windGust80mKTS>18</windGust80mKTS>
<avgDewpointC>13</avgDewpointC>
<precipIN>0</precipIN>
<windSpeedMax80mKTS>18</windSpeedMax80mKTS>
<windDirMinDEG>12</windDirMinDEG>
<windSpeedMaxKPH>26</windSpeedMaxKPH>
<windSpeedMin80mKTS>10</windSpeedMin80mKTS>
<feelslikeF>72</feelslikeF>
<validTime>2022-10-12T07:00:00+02:00</validTime>
<windSpeedMin80mMPH>11</windSpeedMin80mMPH>
<solradMaxWM2>743</solradMaxWM2>
<avgTempC>26</avgTempC>
<windSpeedMin80mKPH>18</windSpeedMin80mKPH>
<weatherPrimaryCoded>::FW</weatherPrimaryCoded>
<sunrise>1665546895</sunrise>
<avgTempF>79</avgTempF>
<windDirMin>NNE</windDirMin>
<maxCoverage/>
<icon>fair.png</icon>
<minFeelslikeC>22</minFeelslikeC>
<dewpointC>16</dewpointC>
<cloudsCoded>FW</cloudsCoded>
<minFeelslikeF>72</minFeelslikeF>
<minHumidity>29</minHumidity>
<dewpointF>60</dewpointF>
<windSpeed80mKTS>10</windSpeed80mKTS>
<pop>0</pop>
<snowCM>0</snowCM>
<windDirMax>E</windDirMax>
<windSpeed80mMPH>12</windSpeed80mMPH>
<windSpeed80mKPH>19</windSpeed80mKPH>
<windDir80mDEG>15</windDir80mDEG>
<maxTempC>31</maxTempC>
<pressureMB>1014</pressureMB>
<visibilityKM>24.135</visibilityKM>
<timestamp>1665550800</timestamp>
<maxTempF>88</maxTempF>
<tempF>null</tempF>
<minDewpointC>11</minDewpointC>
<solradMinWM2>0</solradMinWM2>
<windSpeedMinKTS>7</windSpeedMinKTS>
<windDirMax80mDEG>96</windDirMax80mDEG>
<windGustKTS>15</windGustKTS>
<windSpeedMinKPH>13</windSpeedMinKPH>
<maxDewpointF>60</maxDewpointF>
<windSpeedMinMPH>8</windSpeedMinMPH>
<avgFeelslikeC>26</avgFeelslikeC>
<uvi>null</uvi>
<windDirMax80m>E</windDirMax80m>
<maxDewpointC>16</maxDewpointC>
<pressureIN>29.95</pressureIN>
<avgFeelslikeF>80</avgFeelslikeF>
<iceaccum>null</iceaccum>
<isDay>true</isDay>
<minTempC>21</minTempC>
<minDewpointF>51</minDewpointF>
<windSpeedKTS>8</windSpeedKTS>
<sunset>1665588484</sunset>
<solradWM2>4740</solradWM2>
<windSpeedKPH>15</windSpeedKPH>
<windGustMPH>17</windGustMPH>
<maxHumidity>68</maxHumidity>
<windSpeedMPH>9</windSpeedMPH>
<windGustKPH>28</windGustKPH>
<windDirMaxDEG>96</windDirMaxDEG>
<tempC>null</tempC>
</periods>
<interval>day</interval>
<place>
<country>eg</country>
<name>cairo</name>
<state>qh</state>
</place>
</response>
<error>null</error>

View File

@@ -1,822 +0,0 @@
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",
["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",["a",[]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]
]]]]]]]]]]]]

View File

@@ -1,822 +0,0 @@
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":
{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}
}}}}}}}}}}}}

View File

@@ -1,317 +0,0 @@
[
{
"_id": "6606c27d2ab4a0102d49420a",
"index": 0,
"guid": "441331fb-84d1-4873-a649-3814621a0370",
"isActive": true,
"balance": "$2,691.63",
"picture": "http://example.abc/32x32",
"age": 26,
"eyeColor": "blue",
"name": "abc",
"gender": "female",
"company": "example",
"email": "abc@def.com",
"phone": "+1 (123) 456-7890",
"address": "123 Main St",
"about": "Laborum magna tempor officia irure cillum nulla incididunt Lorem dolor veniam elit cupidatat amet. Veniam veniam exercitation nulla consectetur officia esse ex sunt nulla nisi ea cillum nisi reprehenderit. Qui aliquip reprehenderit aliqua aliquip aliquip anim sit magna nostrud dolore veniam velit elit aliquip.\r\n",
"registered": "2016-07-22T03:18:11 -01:00",
"latitude": -21.544934,
"longitude": 72.765495,
"tags": [
"consectetur",
"minim",
"sunt",
"in",
"ut",
"velit",
"anim"
],
"friends": [
{
"id": 0,
"name": "abc def"
},
{
"id": 1,
"name": "ghi jkl"
},
{
"id": 2,
"name": "mno pqr"
}
],
"greeting": "Hello, abc! You have 10 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "6606c27d0a45df5121fb765f",
"index": 1,
"guid": "fd774715-de85-44b9-b498-c214d8f68d9f",
"isActive": true,
"balance": "$2,713.96",
"picture": "http://placehold.it/32x32",
"age": 27,
"eyeColor": "green",
"name": "def",
"gender": "female",
"company": "sample",
"email": "def@abc.com",
"phone": "+1 (123) 456-78910",
"address": "1234 Main St",
"about": "Ea id cupidatat eiusmod culpa. Nulla consequat esse elit enim et pariatur eiusmod ipsum. Consequat eu non reprehenderit in.\r\n",
"registered": "2015-04-06T07:54:22 -01:00",
"latitude": 83.512347,
"longitude": -9.368739,
"tags": [
"excepteur",
"non",
"nostrud",
"laboris",
"laboris",
"qui",
"aute"
],
"friends": [
{
"id": 0,
"name": "sample example"
},
{
"id": 1,
"name": "test name"
},
{
"id": 2,
"name": "aaa aaaa"
}
],
"greeting": "Hello, test! You have 7 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "6606c27dfb3a0e4e7e7183d3",
"index": 2,
"guid": "688b0c36-98e0-4ee7-86b8-863638d79b5f",
"isActive": false,
"balance": "$3,514.35",
"picture": "http://placehold.it/32x32",
"age": 32,
"eyeColor": "green",
"name": "test",
"gender": "female",
"company": "test",
"email": "test@test.com",
"phone": "+1 (123) 456-7890",
"address": "123 Main St",
"about": "Mollit officia adipisicing ex nisi non Lorem sunt quis est. Irure exercitation duis ipsum qui ullamco eu ea commodo occaecat minim proident. Incididunt nostrud ex cupidatat eiusmod mollit anim irure culpa. Labore voluptate voluptate labore nisi sit eu. Dolor sit proident velit dolor deserunt labore sit ipsum incididunt eiusmod reprehenderit voluptate. Duis anim velit officia laboris consequat officia dolor sint dolor nisi ex.\r\n",
"registered": "2021-11-02T12:50:05 -00:00",
"latitude": -82.969939,
"longitude": 86.415645,
"tags": [
"aliquip",
"et",
"est",
"nulla",
"nulla",
"tempor",
"adipisicing"
],
"friends": [
{
"id": 0,
"name": "test"
},
{
"id": 1,
"name": "sample"
},
{
"id": 2,
"name": "example"
}
],
"greeting": "Hello, test! You have 1 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "6606c27d204bc2327fc9ba23",
"index": 3,
"guid": "be970cba-306e-4cbd-be08-c265a43a61fa",
"isActive": true,
"balance": "$3,691.63",
"picture": "http://placehold.it/32x32",
"age": 35,
"eyeColor": "brown",
"name": "another test",
"gender": "male",
"company": "TEST",
"email": "anothertest@anothertest.com",
"phone": "+1 (321) 987-6543",
"address": "123 Example Main St",
"about": "Do proident consectetur minim quis. In adipisicing culpa Lorem fugiat cillum exercitation velit velit. Non voluptate laboris deserunt veniam et sint consectetur irure aliqua quis eiusmod consectetur elit id. Ex sint do anim Lorem excepteur eu nulla.\r\n",
"registered": "2020-06-25T04:55:25 -01:00",
"latitude": 63.614955,
"longitude": -109.299405,
"tags": [
"irure",
"esse",
"non",
"mollit",
"laborum",
"adipisicing",
"ad"
],
"friends": [
{
"id": 0,
"name": "test"
},
{
"id": 1,
"name": "sample"
},
{
"id": 2,
"name": "example"
}
],
"greeting": "Hello, another test! You have 5 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "6606c27df63eb5f390cb9989",
"index": 4,
"guid": "2c3e5115-758d-468e-99c5-c9afa26e1f9f",
"isActive": true,
"balance": "$1,047.20",
"picture": "http://test.it/32x32",
"age": 30,
"eyeColor": "green",
"name": "Test Name",
"gender": "female",
"company": "test",
"email": "testname@testname.com",
"phone": "+1 (999) 999-9999",
"address": "999 Test Main St",
"about": "Voluptate exercitation tempor consectetur velit magna ea occaecat cupidatat consectetur anim aute. Aliquip est aute ipsum laboris non irure qui consectetur tempor quis do ea Lorem. Cupidatat exercitation ad culpa aliqua amet commodo mollit reprehenderit exercitation adipisicing amet et laborum pariatur.\r\n",
"registered": "2023-01-19T02:43:18 -00:00",
"latitude": 14.15208,
"longitude": 170.411535,
"tags": [
"dolor",
"qui",
"cupidatat",
"aliqua",
"laboris",
"reprehenderit",
"sint"
],
"friends": [
{
"id": 0,
"name": "test"
},
{
"id": 1,
"name": "sample"
},
{
"id": 2,
"name": "example"
}
],
"greeting": "Hello, test! You have 6 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "6606c27d01d19fa29853d59c",
"index": 5,
"guid": "816cda74-5d4b-498f-9724-20f340d5f5bf",
"isActive": false,
"balance": "$2,628.74",
"picture": "http://testing.it/32x32",
"age": 28,
"eyeColor": "green",
"name": "Testing",
"gender": "female",
"company": "test",
"email": "testing@testing.com",
"phone": "+1 (888) 888-8888",
"address": "123 Main St",
"about": "Cupidatat non ut nulla qui excepteur in minim non et nulla fugiat. Dolor quis laborum occaecat veniam dolor ullamco deserunt amet veniam dolor quis proident tempor laboris. In cillum duis ut quis. Aliqua cupidatat magna proident velit tempor veniam et consequat laborum ex dolore qui. Incididunt deserunt magna minim Lorem consectetur.\r\n",
"registered": "2017-10-14T11:14:08 -01:00",
"latitude": -5.345728,
"longitude": -9.706491,
"tags": [
"officia",
"velit",
"laboris",
"qui",
"cupidatat",
"cupidatat",
"ad"
],
"friends": [
{
"id": 0,
"name": "test"
},
{
"id": 1,
"name": "sample"
},
{
"id": 2,
"name": "example"
}
],
"greeting": "Hello, testing! You have 2 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "6606c27d803003cede1d6deb",
"index": 6,
"guid": "4ee550bc-0920-4104-b3ce-ebf9db6a803f",
"isActive": true,
"balance": "$1,709.31",
"picture": "http://sample.it/32x32",
"age": 31,
"eyeColor": "blue",
"name": "Sample Name",
"gender": "female",
"company": "Sample",
"email": "sample@sample.com",
"phone": "+1 (777) 777-7777",
"address": "123 Main St",
"about": "Lorem ex proident ipsum ullamco velit sit nisi eiusmod cillum. Id tempor irure culpa nisi sit non qui veniam non ut. Aliquip reprehenderit excepteur mollit quis excepteur ex sit. Quis do eu veniam do ullamco occaecat eu cupidatat nisi laborum tempor minim fugiat pariatur. Ex in nulla ex velit.\r\n",
"registered": "2019-04-08T03:54:36 -01:00",
"latitude": -70.660321,
"longitude": 71.547525,
"tags": [
"consequat",
"veniam",
"pariatur",
"aliqua",
"cillum",
"eu",
"officia"
],
"friends": [
{
"id": 0,
"name": "Test"
},
{
"id": 1,
"name": "Sample"
},
{
"id": 2,
"name": "Example"
}
],
"greeting": "Hello, Sample! You have 6 unread messages.",
"favoriteFruit": "apple"
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +0,0 @@
{
"foo":
[
"bar",
"baz"
],
"": 0,
"a/b": 1,
"c%d": 2,
"e^f": 3,
"g|h": 4,
"i\\j": 5,
"k\"l": 6,
" ": 7,
"m~n": 8,
"obj" : {
"key" : "value",
"other~key" : {
"another/key" : [
"val"
]
},
"" : {
"" : "empty key of an object with an empty key",
"subKey" : "Some other value"
}
}
}