Determines if the specified string is JSON encoded.
Parameters:
Name | Type | Description |
---|---|---|
str | string | The string to be tested. |
- Since
- 1.0.0
- Source
Returns:
Returns true if the specified string is JSON encoded. Returns false otherwise.
- Type:
- boolean
Example
import { isJson } from "@gravityforms/utils";
function Example() {
const str = '{"name":"John", "age":30}';
const isJsonEncoded = isJson( str );
}