Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
roytuts authored May 8, 2019
1 parent 218c87e commit a93907c
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
40 changes: 40 additions & 0 deletions json-sanitizer/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<project xmlns="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.jeejava</groupId>
<artifactId>json-sanitizer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>json-sanitizer</name>
<url>https://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
</properties>

<dependencies>
<!-- JSON sanitizer -->
<dependency>
<groupId>com.mikesamuel</groupId>
<artifactId>json-sanitizer</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.jeejava.json.sanitizer;

public class JsonSanitizer {

public static String jsonSanitizeOne(String jsonString) {
String wellFormedJson = com.google.json.JsonSanitizer.sanitize(jsonString);
return wellFormedJson;
}

protected static String jsonSanitizeTwo(String jsonString) {
String wellFormedJson = com.google.json.JsonSanitizer.sanitize(jsonString);
String responseThree = jsonSanitizeThree(jsonString);
System.out.println(responseThree);
return wellFormedJson;
}

private static String jsonSanitizeThree(String jsonString) {
return jsonString;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.jeejava.json.sanitizer;

public class JsonSanitizerTest {

public static void main(String[] args) {
String jsonString = "{\"key1\":\"value1\",\"type\":\"Booking\",\"sid\":\"A43521\",\"region\":\"ASIA\","
+ "\"fetchFromFile\":\"false\",\"service\":\"true\",\"isEom\":\"true\",*#@!}";

String responseOne = JsonSanitizer.jsonSanitizeOne(jsonString);
System.out.println(responseOne);

String responseTwo = JsonSanitizer.jsonSanitizeTwo(jsonString);
System.out.println(responseTwo);
}
}

0 comments on commit a93907c

Please sign in to comment.