After lots of try & error as well as googling around for similar posts, I manage to find the following post which lead me the below solution:
http://blog.thekensta.com/2012/06/google-app-engine-bulk-loader-and-ndb.html
In short, JsonProperties are stored as blobs and we need to pass the bulkloader the correct transform method to generate a blob from the json string. We can use transform.blobproperty_from_base64
(from the google.appengine.ext.bulkload.transform
module)
So I convert my list or dict to a string JSON string representation which then gets converted to a blob so that the bulkloader can store it:
import_transform: "lambda x: transform.blobproperty_from_base64(base64.b64encode(bytes(json.dumps(x.strip(' ,').split(',')))))"
The same reasoning fixes the TextProperty saved as Strings (mentioned in my comment above). You need to use db.Text
as the transform function:
import_transform: db.Text
And to save a repeated=True
TextProperty, I actually had to transform it to a blob as well:
import_transform: "lambda x: transform.blobproperty_from_base64(base64.b64encode(bytes(json.dumps(x.strip(' ,').split(',')))))"
(in the exemple above I actually turn a coma separated string into a list of Text objects to be stored in a TextProperty(repeated=True)