Example given here at db-fiddle.
CREATE TABLE `oa24_json` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`appnum` varchar(8) NOT NULL,
`oa_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`oa_json`)),
`last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
The JSON I’m attempting to INSERT was validated at jqplay.org.
When I attempt to INSERT the JSON that was validated at jqplay.org, mysql/mariadb Error Code 4025 CONSTRAINT occurs (presumably it didn’t pass the JSON_VALID test).
Escaping the embedded apostrophe characters within this JSON string works for this simple case:
SELECT JSON_VALID('{"response":{"numFound":7,"start":0,"docs":[
{
"patentApplicationNumber":["16286064"],
"applicationDeemedWithdrawnDate":"0000-12-30T05:00:00Z",
"applicationStatusNumber":120,
"inventionTitle":["INITIATING A FUNDS TRANSFER FROM A PLAYER'S MOBILE DEVICE TO A CASINO WALLET THAT REQUIRES HUMAN VALIDATION OF THE PLAYER'S IDENTITY"]
}]}}') AS 'Valid ?';
However, it does not work for the actual (lengthy) data given at the db-fiddle example that has 107 embedded apostrophes. So my question is: What else I missing to make this valid JSON acceptable to JSON_VALID?
N.B. For the data given at the db-fiddle, I only escaped the apostrophes contained within the JSON strings; the other escaped characters (e.g., n, “) within the JSON strings were programmatically generated by the United States Patent and Trademark Office, (USPTO).