How to store a blob of JSON in Airtable? - json

There does not appear to be a dedicated field type in Airtable for "meta" data blobs and/or a JSON string.
Is the "Attachment" type my best bet?

I could store it either as a json attachment, or on a String type column.
Since a full json on a text column would likely not be readable, I would store it as attachments.
However, it seems that at least for now, uploading attachments require the file to be already hosted somewhere first, so this route might not be the easiest one:
https://community.airtable.com/t/is-it-possible-to-upload-attachments/188
Right now this isn’t possible with the Airtable API alone. It’s
something we’ll think about for future API versions though. A
workaround for now is to use a different service
(e.g. Filestack90, imgur52, etc.) to process the upload before then
sending the url to Airtable. When Airtable processes the attachment,
it will copy the file to Airtable’s own (S3) server for safekeeping,
so it’s OK if the original uploaded file url is just temporary

Related

Submiting parsed content into ElasticSearch

I am trying to upload files(.txt, .pdf) in Elasticsearch. Elasticsearch receives only content in json format. Is there any way that I send parsed content(.pdf or .txt to String) directly or I have to parse String into json document to send it to Elasticsearch.
You can only send JSON when indexing a Document, so basically, a base64 encoded version of the file in some field of that JSON will do just fine. If you do not wish to search inside this content, then all you have to do is disabling indexing on that "binary data" field (option index:false in your mapping).
If you wish to send a PDF file and have the textual content extracted and indexed / searchable, you should have a look at the Ingest Attachment Plugin.
You can look at this https://github.com/dadoonet/fscrawler for your use case.
Basically, This crawler helps to index binary documents such as PDF, Open Office, MS Office and will give you following feature
Local file system (or a mounted drive) crawling and index new files,
update existing ones and removes old ones.
Remote file system over SSH crawling.
REST interface to let you "upload" your binary documents to
elasticsearch.

What does a JSON file do?

I went through previous posts on SO and some of the answers say that a JSON file is used to send data from server to client.
Well that seems to be okay but then we can create package.json, Apidoc.json, manifest.json which do not interact with the client and server
So can someone tell me what actually is a JSON file?
JSON stands for JavaScript Object Notation. It is used to describe a data structure in a simple format. It can be a plain text file, which may be used to pass data from the server to a client, but it could be equally used to hold and consume that data at the same layer e.g. you could have a configuration file at the client side which is read an interpreted by your application.
Note also that JSON does not need to be held in a file; you could create a string variable with JSON data in it and pass this from one method to another without ever storing it in a file.
The tag definition in Stack Overflow can be found here https://stackoverflow.com/tags/json/info and further information can be found here https://www.json.org/.
JSON is a file format, just like CSV. Just because CSV is used with Microsoft Excel, does not mean that is all it is used for (just like with JSON). Just because it is common to get info from a server in JSON format, does not mean that is all JSON is used for. Do some googling before asking a question like this on Stack Overflow.
Here is an intro to JSON. JSON Intro W3Schools

Keep form files after validation error

I have a form where I simultaneously send several (let's say 10) files to the backend, along with some other regular input fields.
When I find a validation problem in the backend I display the form again and fill the regular inputs (dropdowns, text inputs, etc.), but I cannot fill the file fields, forcing the user to select the files from the file directory again.
The solution I think of is sending the base64 encoded representation of the files, and put them back in the form in case there is a validation error, but I would like to know if there is a simpler way.
No matter what you do, you can not skip server-side validation. For security reasons (someone sending raw requests for example). As far as showing the files in case of error (or simple reloading) I would send it as Base64, but via AJAX if the files are large.
Client-side validation: most validations (if not all) can be done using plain JS. Be it filesize, content type... and more specific validations according to filetypes (image, document...)
Server-side validation: Once sent, fully validate the file and content.
Send files back:In case of error, send the files with the request if small. If big send them via AJAX to avoid blocking and keep page loading times fast.
Hope it helps!
The simplest thing to do would be :
1) Validate all fields on the client side (javascript/jquery)
2) Once all other inputs are validated, then you send in Files.
NB: If you need to validate some values on the server side, use ajax for both steps (1) and (2). Also, try to give a bit more details to get quality answers
I would create a temporary store for uploaded files and would send back only a unique-hard-to-guess ID got from the store instead than the whole file.
The form section for a single file upload would then include also an hidden input carrying the unique file-ID.
When processing the request: if there is a file in the request get the file (and store it if form not valid) otherwise if there is a file-ID get the file from store.

how to save JSON data into SDCard phoneGap

We have sqLite Table.Now We converted db data into JSON Object.We need JSON data save to my mobile Sd_Card.Any file like .txt or excel or word any type of format not problem.
We need JSON data Save to Local phone-memory or SD-Card.guide me how to save.First Tell me it's possible or not
Well, all you are asking is if it is possible, so that's easy, yes. You said "phone memory" or SD-Card. I assume you mean persistent memory, like with WebSQL. Since JSON is just a string, you can insert it into a WebSQL table just fine. You could also, more easier, store it in LocalStorage. Finally, if you want to use the file system, that's simple too, just be sure to add the File plugin.

Send Json inside FormData as File alongside files

I was wondering if it was ok to encode json data as a blob (using atob) alongside some other binary data to the server, and then reload the json file file into memory to save it in the database?
I am doing this in order to prevent multiple posts to the server, I could for example, send the json data, validate it, and when it's OK, I could send the files with some Ids, and then link the both of them server side.
but this method seems broken, because if the user leaves the browser while he is sending the data, and part of the files have been sent, then i'd have alot of uncomplete posts.
Thanks for your answers in advance.