Some databases (postgres, sql server,  others) support native json columns.
With postgres, there's a native jsonb type, with sql server it's a string type, 
that you can treat as json.

In any event, once you have the json in the database, one can then query it, 
e.g.:

SELECT id,product_name,
       JSON_VALUE(attributes, '$.material') AS material
FROM jsontest;

So, here's my question:

If you have a flow file that contains json, whats the best way to insert that 
into a database?
The only thing I've thought of so far is if you have the json string
{"material" : "plastic"}
You then use a TEXT processor to turn that into
{"attributes": {'{"material" : "plastic"}'}
And then use a PutDatabaseRecord to actually write the entry.

Is there a better, or more efficient way to do it?



Reply via email to