gpt4 book ai didi

java - 从 Vertex 实例中获取 Json 格式的 String

转载 作者:行者123 更新时间:2023-12-02 15:18:46 24 4
gpt4 key购买 nike

在具有 OrientDB 数据库的 Java 应用程序中,在我拥有 Vertex 对象之后,我需要将其属性提取到 String 对象中。该对象必须是 Json 格式。预期结果的一个例子是:

 {"@type":"d","@rid":"#13:1093","@version":1,"@class":"V_Notification","lastUpdateDate":"2016-07-20 16:45:31","lastUpdateUser":"#12:41","creationDate":"2016-07-20 16:45:31","creationUser":"#12:41","type":"user_added_to_share_made_upload","description":"user_added_to_share_made_upload","sphereId":"#16:18","out_E_NotificationUser":["#45:1091"],"deleted":false,"version":0,"isRead":false,"@fieldTypes":"lastUpdateDate=t,lastUpdateUser=x,creationDate=t,creationUser=x,out_E_NotificationUser=g"}

最佳答案

你可以使用

OrientVertex v=g.getVertex("#9:0");
ODocument d=v.getRecord();
String json=d.toJSON();

希望对你有帮助

关于java - 从 Vertex 实例中获取 Json 格式的 String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38833674/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com