Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions parsers/test_java_fastjson_2_0_53/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: TestJSONParsing
Class-Path: fastjson2-2.0.53.jar
5 changes: 5 additions & 0 deletions parsers/test_java_fastjson_2_0_53/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
javac -cp ".:fastjson2-2.0.53.jar" TestJSONParsing.java

jar cvfm TestJSONParsing.jar META-INF/MANIFEST.MF fastjson2-2.0.53.jar TestJSONParsing.class

java -jar TestJSONParsing.jar
Binary file not shown.
Binary file not shown.
44 changes: 44 additions & 0 deletions parsers/test_java_fastjson_2_0_53/TestJSONParsing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// javac -cp ".:fastjson2-2.0.53.jar" TestJSONParsing.java && java -classpath ".:fastjson2-2.0.53.jar" TestJSONParsing x.json

import java.nio.charset.StandardCharsets;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONException;

public class TestJSONParsing {

public static boolean isValidJSON(String s) {
try {
Object obj = JSON.parse(s);
System.out.println(obj);
return true;
} catch (JSONException e) {
System.out.println(e);
return false;
}
}

public static void main(String[] args) {

if(args.length == 0) {
System.out.println("Usage: java TestJSONParsing file.json");
System.exit(2);
}

try {
String s = new String(Files.readAllBytes(Paths.get(args[0])));
if(isValidJSON(s)) {
System.out.println("valid");
System.exit(0);
}
System.out.println("invalid");
System.exit(1);
} catch (IOException e) {
System.out.println("not found");
System.exit(2);
}
}
}
Binary file not shown.
5 changes: 5 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@
"url":"",
"commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_json_tree/TestJSONParsing.jar")]
},
"Java Fastjson2 2.0.53":
{
"url":"",
"commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_fastjson_2_0_53/TestJSONParsing.jar")]
},
"Scala Dijon 0.3.0":
{
"url":"",
Expand Down