I'm trying to parse WHERE clause of mysql query into an expression to get data from json file
For example:
`price`=8.95 AND `title`="The Lord price= AND of the Rings"
above example should be converted to the below string after replacing price and title value on left hand side
8.95==8.95 && 'The Lord price= AND of the Rings'=="The Lord price= AND of the Rings"
I have created one code (jsfiddle) to achieve this but this will break if I add AND ` in value as show below (it returns false if condition is not matching)
var obj = {price: 8.95, title: "'The Lord price= AND `of the Rings'"};
var whereString = '`price`=8.95 AND `title`="The Lord price= AND `of the Rings"';
So I wanted to understand is there any other better way to achieve this?