+ 8
Which one is better either .txt file or .json file
I wanna take 4 input that is I'd, Name, age and class from user at different time. Make it easy to access and edit. It look like json format but if you want you can change it. { 8679: { 'Name': 'Vaibhav', 'age': 17, 'Class':12 }, 8758: { 'Name': 'Aman', 'age': 17, 'Class':12 } }
6 Respostas
+ 21
txt is not a good format for structured data, because it does not give any restrictions, completely freeform text.
csv is a little better, if you have a flat data structure - you can imagine it if it would be easy to put it in a spreadsheet, only rows and colums, no internal lists or objects. Even in your scenario it would work nicely.
json is much more flexible especially if you have to deal with complex data with multiple levels of nesting. And it has very strict format requirements. If you want to let the user edit the json, they must do it very carefully, they cannot miss a single comma or brace. From this point, csv is easier to manage.
+ 6
xml is also really good way to provide input data.
I think that its better than json in some cases because of the xml schemas.
xml schema can describe the structure of the input xml file where you can specify what properties are required and what type of datatypes the values must be eg...
We may not need to validate the file in our application so specifically.
+ 2
But if we want I'd [ 8679 or 8758 ] can anyone give the syntax of extract this data in json and nested dictionary both
+ 1
.json is best for json format data