'how to manipulate JSON files and add fields according to other fields
I have a JSON file that contains answers that user's answers I want to generate an SQL query that changed according to the user's answers and add it as a new field to the JSON file.
For example: If the on the JSON file “payment method”=“cash” then the SQL query will be Select * from payments where method="cash";
If the on the JSON file “payment method”=“CreditCard” then the SQL query will be Select * from payments wherem ethod="CreditCard";
Writing in python I prefer that the mapping file will be stored in a separate config file. So it will easier to manage all the different cases and parameters.
Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
