how to verify json format is valid
I use Gson class in order to convert a
Json object into a java object.
If it works without any error, it means that it is a valid json format...
import com.google.gson.Gson;
public class JSONUtils {
Gson gson = new Gson();
public boolean isJSONValid(String jsonInString) {
try {
gson.fromJson(jsonInString, Object.class);
return true;
} catch(com.google.gson.JsonSyntaxException e) {
return false;
}
}
}
Also in JavaScript:
- make object readonly javascript
- componentWillUnmount functional component for asynchronous requests
- js get date in ms
- js object clear
- javascript get index
- install vue-cli
- array unique values javascript
- code a space scene in js
- passing data variable using ajax
- replacing characters in string javascript
- invoking jquery validator
- javascript sessionStorage
- useeffect cleanup function
- string to boolean javascript
- export multiple functions react
- mongoose nullable
- how to cast to javascript executor
- how to check the extension of a file in javascript
- javascript radian to degree
- define a while loop in node js
- how to get the value of radio button in jquery
- javascript create object key from variable
- javaascript all
- react font awesome