将JSON作为值存储在Cloud Datastore中的嵌入式实体中 [英] Saving JSON as a value inside embedded entities in Cloud Datastore

查看:74
本文介绍了将JSON作为值存储在Cloud Datastore中的嵌入式实体中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google Cloud Store实体中-是否可以将JSON存储为嵌入式实体属性的VALUE?

In Google Cloud Store entities - is there a way to store JSON as the VALUE of an embedded entity property?

例如,我期望这样的事情:

For example, I would expect something like this:

{
    "properties": {
        "someObject": {
            "objectValue": {"some":"sutome","json":"object"}
        }
    }
}

objectValue将是属性的类型

谢谢

推荐答案

在Google Cloud Store实体中-是否可以将JSON存储为嵌入式实体属性的VALUE?

In Google Cloud Store entities - is there a way to store JSON as the VALUE of an embedded entity property?

不直接.但是,您可以做的是对JSON对象进行字符串化并将其存储为StringValue(记住,一旦检索到该值,便会将其解析回JSON对象).请注意,如果对存储字符串值的属性进行索引,则字符串的最大大小为1500个字节;如果不对属性进行索引,则字符串的最大大小为1MB(1,000,000字节).

Not directly. However, what you can do is stringify the JSON object and store it as a StringValue (just remember to parse the value back into a JSON object once you retrieve it). Note that if the property that stores the string value is indexed the maximum size the string can be is 1500 bytes, if the property is not indexed the max size of the string is 1MB(1,000,000 bytes).

这篇关于将JSON作为值存储在Cloud Datastore中的嵌入式实体中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆