Imagine a scenario where you’ve been developing locally with dummy data and at some point decided to move this data to a Firebase instance.
Assuming your JSON file contents looks like the following.
If your design doesn’t require the use of unique identifiers for each object, fine, you’re good to just go ahead and use this simple bash script.
However, if you wish to assing a UID to each object inside your array you might want to do something more like the following. This way you’re sure to get Firebase to associate your array objects to unique identifiers as key/value pairs inside a reference.
If you’re app have security policies in place you might need to append a query parameter to the data url your passing to
http. You’ll need your Firebase app’s secret, which you can find under the Secrets panel of your Firebase app’s dashboard.
Go ahead and try it. If you’re using Homebrew on a Mac you can
$ brew install jq httpie to have these binaries available on your command line.
Comment bellow and let me know what you think. Have fun!