From the manual:

-e / --exit-status:

Sets the exit status of jq to 0 if the last output values was neither false nor null, 1 if the last output value was either false or null, or 4 if no valid result was ever produced. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran.

So you can use:

if jq -e . >/dev/null 2>&1 <<<"$json_string"; then
    echo "Parsed JSON successfully and got something other than false/null"
else
    echo "Failed to parse JSON, or got false/null"
fi

In fact, if you don't care about distinguishing between the different types of error, then you can just lose the -e switch. In this case, anything considered to be valid JSON (including false/null) will be parsed successfully by the filter . and the program will terminate successfully, so the if branch will be followed.

Answer from Tom Fenech on Stack Overflow
🌐
Jqueryvalidation
jqueryvalidation.org
jQuery Validation Plugin | Form validation with jQuery
This jQuery plugin makes simple clientside form validation easy, whilst still offering plenty of customization options. It makes a good choice if you’re building something new from scratch, but also when you’re trying to integrate something into an existing application with lots of existing ...
Reference documentation
Apart from required itself and equalTo, all validation methods declare an element valid when it has no value at all. That way an email field is optional unless required is specified. You can specify an element input to contain a valid email address, or nothing at all. Use jQuery.validator.addMethod ...
Documentation
There is also an article discussing how this plugin fits the bill of the should-be validation solution. ... A single line of jQuery to select the form and apply the validation plugin, plus a few annotations on each element to specify the validation rules.
🌐
jQWidgets
jqwidgets.com › jquery-widgets-documentation › documentation › jqxvalidator › jquery-validator-getting-started.htm
jQuery Validator Plugin
jqxValidator is jQWidgets plugin used for validating html forms using JavaScript. It has a set of build in rules (for required inputs, e-mail, SSN, ZIP, max value, min value, interval etc.) used for validating the user inputs. You can also write a custom rule which will fit best to your ...
🌐
Jqueryvalidation
jqueryvalidation.org › documentation
Documentation | jQuery Validation Plugin
rule: A validation rule associates an element with a validation method, like "validate input with name "primary-mail" with methods "required" and "email". This library adds three jQuery plugin methods, the main entry point being the validate method:
🌐
DevTools Daily
devtoolsdaily.com › jq_playground
Free Online JQ Playground
Free online JQ playground to test JSON queries, transform data, and debug filters instantly with sample data, examples, and quick copy/share support.
🌐
Utilities and Tools
utilities-online.info › jquery-validator
JQuery Validator
JQuery Validator · JQuery Validator · Help us make tools better by telling us your review about this tool · Your Feedback submitted successfully. "Tool functionality is good." Continue · Back · View a reference table of ASCII characters and their corresponding codes.
🌐
GitHub
github.com › jqlang › jq › issues › 1637
is it possible to use jq purely to tell me if the input file is valid or not? · Issue #1637 · jqlang/jq
March 28, 2018 - I have a pretty specific usecase, but I think it would be valuable for the tool itself. I want to know if it's possible to do something like this. $ cat file.json | jq --validate # output message or only output on error. I think the abil...
Author   davidawad
Find elsewhere
🌐
Jqlang
play.jqlang.org
jq playground
jq playground is open-source and licensed under the MIT license. All jq queries and HTTP requests to fetch JSON are processed locally in your browser. Snippets are only sent to the server when you choose to share them.
🌐
GitHub
github.com › jqlang › jq › issues › 1539
How to validate a JSON string with jq? · Issue #1539 · jqlang/jq
November 26, 2017 - $ echo '123' | jq . 123 $ echo $? 0 $ echo '{"a": 1' | jq . // will not output anything $ echo $? 0 $ echo '{"a":1}' | jq .
Author   cnfn
🌐
GitHub
github.com › KrimeFarm › jq-validator
GitHub - KrimeFarm/jq-validator: An easy to use jQuery validation plugin tailored for Bootstrap
An easy to use jQuery validation plugin tailored for Bootstrap - KrimeFarm/jq-validator
Author   KrimeFarm
🌐
GitHub
github.com › CICDToolbox › json-lint
GitHub - CICDToolbox/json-lint: Validate your JSON files using jq.
A tool to validate your JSON files using jq.
Starred by 10 users
Forked by 3 users
Languages   Shell 100.0% | Shell 100.0%
🌐
GitHub
gist.github.com › staabm › 240fa96929f0429f6fb2
jq-validate input event · GitHub
jq-validate input event. GitHub Gist: instantly share code, notes, and snippets.
🌐
GitHub
github.com › jquery-validation › jquery-validation
GitHub - jquery-validation/jquery-validation: jQuery Validation Plugin library sources · GitHub
<form> <input required> </form> <script src="jquery.js"></script> <script src="jquery.validate.js"></script> <script> $("form").validate(); </script>
Starred by 10.3K users
Forked by 2.7K users
Languages   JavaScript 95.5% | HTML 4.5%
🌐
Jqlang
jqlang.github.io › jq
jq
jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.