How to use JSON to export data - json

Thank you in advance for all your support.
I wanted to inquire about using JSON. I understand that JSON is used as a means to take data from the db and display it on a HTML page (or perhaps even export the data to a csv file). What I am not understanding is do we use JSON to exports all kinds of data, even sensitive data such as SSN, Username, Password and etc...? I have done some research and what I am finding is that many articles mention not extract this kind of data but I do not understand why. My end objective is to build a system where I want to allow my clients to be able to export data from my system to theirs. I would like to also mention that I am building this using MongoDB. I'm not sure if this really matters or not, but thought I would mention it.
I am really looking for knowledge here about JSON and how to correctly use it. I don't need to know how to write JSON or something.
Thanks in advance again.
AJ

Actually, MongoDB uses BSON, not JSON. The MongoDB shell and some drivers abstracts it as JSON to make it more human-readable.
MongoDB has no build-in support for data encryption. That means when you have sensitive information, you should encrypt it before putting it into the database and decrypt it after you retrieve it.

Related

Uploading Data into Redis

I am working on school project where we need to create website and use Redis to search database, in my case it will be movie database. I got JSON file with names and ratings of 100 movies. I would like to upload this dataset into Redis instead on entering the entire dataset manually. JSON file is saved on my desktop and I am using Ubuntu 20.04.
Is there a way to do it?
I have never used Redis so my question might be very silly. I've been looking all over the internet and cannot find exactly what needs to be done. I might be googling incorrect question maybe that's why I cannot find the answer.
Any help would be appreciated.
Write an appropriate program to do the job. There's no one-size-fits-all process because how your data is structured in redis is up to you; once you decide on that, it should be easy to write a program to parse the JSON and insert the data.

MySQL or JSON view base on Node.js app and API

I know this kind of question is ask in many different ways, and I know that's annoying for answering so much same question, but as I google it, search in Stackoverflow I can't really find a nice answer, the answer I'm asking is based on views like easy for answering API request (which is in JSON format) and in the view of I'm designing Node.js APP
So here is my case
I'm building my own Node.js application somehow like a CMS or blogging platform so imagine I need a place to store all my posts data where should I store in a MySQL database or External JSON file it's quite confusing I personally prefer JSON since it's nice looking (?) but it's quite hard to use fs.writefile and fs.readfilesync to update data in the external JSON, but I don't know how to make an API that will give the post data by MySQL database since the API is in the JSON format
If I have any misunderstood please tell me
if you want to store data in json then go form nosql database like mongodb. Postgresql latest versions also supports JSON data types.
Maybe what you need is ORM module, for example sequelize
It works with MySQL/Postgres, and offers you APIs like MongoDB.

Best File format to import data into remote MySQL from a local software

Let me clarify what I am exactly looking for. I am building a dynamic website for a school on php mysql platform which will require certain data to be updated from the local offline software that the school uses. I am in touch with the software provider and the software provider is ready to provide the data in whatever format is required by me.
So what would be the best format, the easiest, fastest and more reliable. Would it be csv, excel, etc. Mostly I will need the student details, grades etc from the local database. What else will I require to take care of in case any of you have done a similar project?
Looking forward to replies.
CSV is the easiest to handle. You don't even need to process it in PHP if you can get it in a format that MySQL can use with LOAD DATA INFILE if you have access to the database server itself.
Excel is not at all easy to import and can be mangled in all kinds of ways that aren't obvious. It's best avoided unless you absolutely need to support it.
If you're building a new application, I really hope you use a popular PHP framework as a foundation. Some of these include modules for handling CSV data, saving you the trouble of having to do that yourself.

Dynamic JSON file vs API

I am designing a system with 30,000 objects or so and can't decide between the two: either have a JSON file pre computed for each one and get data by pointing to URL of the file (I think Twitter does something similar) or have a PHP/Perl/whatever else script that will produce JSON object on the fly when requested, from let's say database, and send it back. Is one more suited for than another? I guess if it takes a long time to generate the JSON data it is better to have already done JSON files. What if generating is as quick as accessing a database? Although I suppose one has a dedicated table in the database specifically for that. Data doesn't change very often so updating is not a constant thing. In that respect the data is static for all intense and purposes.
Anyways, any thought would be much appreciated!
Alex
You might want to try MongoDB which retrieves the objects as JSON and is highly scalable and easy to setup.

Importing JSON strings via CSV into MySQL. Good or bad?

I'm sitting on a CSV import into a database trying to think of ways to add more data without having to change the API (add new fields).
Since working with JSON quite a bit on the client, I'm thinking of storing data into MYSQL as JSON string. So if I have a field
image_filenames
Where I'm currently storing data like this:
img123.jpg
WOuld it make sense to store multiple images in a JSON array like so:
{"img_base":"img123.jpg", "img_alt_1":"img123-1.jpg", "img_alt_2":"img123-2" }
I can deserialize server side, so it woudn't be much of a problem to grab the image I need from the JSON array, while it does not bloat up the API.
Question:
I can't find anything at all on importing CSV with JSON strings. So, what's good and bad in doing so? Are there security concerns (SQL-injections)?
Thanks!
Transferred from comments to here:
If you have a data model scheme that changes or is inconsistent, then the relational database storage isn't the best choice. Sure, you can serialize it and store as binary string, but why? IMO, and I'm not a fan of NoSQLs, but MongoDB looks like something you might make use of. Its document scheme is JSON-based, it'd be familiar to you if you work with JSON-based code on a daily basis. I'd use that to store the data rather than relational db.
Non-relational ones do less work, so they work faster in some scenarios. They also don't have a scheme, so there's no alter table statement as such, therefore you can add "columns" as much as you like. If you don't have relations and need something to store data in JSON format, but that it can be searchable - MongoDB would be great.