Is JSON transform action

Check If String is Valid JSON

Use case

You are working with an API and the return comes back as a JSON string instead of being a JSON object. You would like to verify that the string is valid JSON before attempting to convert it to JSON.

Overview

This transform will check whether or not a string provided via the 'String to Check' input is a valid JSON string.


Parameters

Parameter
Description
Required

String to Check

The string to validate.

This transform is useful for confirming a string is a valid JSON string prior to converting it to json using a filter such as |json

Usage

Example 1: Providing a valid JSON string

Input:

{"test":"test"}
Example 2: Providing a invalid JSON string

Input:

I am not a JSON string!

Results Output

This transform will output a boolean value (True/False) based on whether or not the string is a valid JSON string.

Return from Example 1:

True

Return from Example 2:

False

Last updated

Was this helpful?