Level 58
You can use JavaScript to check if the data entered in the HTML form matches the JSON data. You can use the JSON.stringify() method to convert the JSON data into a string and then use the indexOf() method to check if the data entered in the HTML form is included in the JSON string. If the data is included, it will return the index of the data in the string, otherwise it will return -1.
// Get the JSON data
const jsonData = {
name: 'John',
age: 25
};
// Convert the JSON data to a string
const jsonString = JSON.stringify(jsonData);
// Get the data entered in the HTML form
const formData = 'John';
// Check if the data entered in the HTML form is included in the JSON string
if (jsonString.indexOf(formData) !== -1) {
console.log('Valid');
} else {
console.log('Invalid');
}