Skip to content

Instantly share code, notes, and snippets.

@pascalgiguere
pascalgiguere / importParseJson.js
Created May 12, 2016 23:24
Node.js script using the Parse REST API to import a JSON file to Parse. Useful when dropping an entire class then reloading it from a JSON backup (Parse export). Will also update pointers of a second Parse class pointing to the imported class so that pointers don't break despite the imported data having different objectIds.
var PARSE_APPLICATION_ID = '';
var PARSE_REST_API_KEY = '';
var JSON_FILE_PATH = ''; // Path to JSON file to import
var IMPORTED_CLASS_NAME = ''; // Class to import
var POINTING_CLASS_NAME = ''; // Class with pointers to imported class
var POINTING_CLASS_PROPERTY = ''; // Name of pointer property
var request = require('request');
var fs = require('fs');