Coredata [INT64]可转换,转换为Swift之外的可用阵列
我有一个具有各种值的Coredata实体。有时我想将值导出到JSON与另一个应用程序共享。我的转换[INT64]变成了数据。 我该如何将其转换回?例如在JavaScript中?
I have a CoreData entity with various values. Sometimes I want to export the values to Json to share with another app. My Transformed [Int64] turns into data.
How can I transform it back? For instance in javascript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经通过直接从应用程序中写入JSON来解决此问题。然后阵列完好无损。
使用.tojson()我在这里来自@mike_notguilty。
编辑:忘记,上面的函数有错误,因为最后一个值在最后也会导致损坏的JSON。我使用这样的东西:
I've solved this by writing an export to json directly from the app. Then the array is intact.
Using .toJSON() which I got here CoreData object to JSON in Swift 3 from @Mike_NotGuilty.
Edit: Forgot, above function has an error because the last value also gets a , at the end, leading to a corrupt JSON. I use something like this: