JSON到JSON转换器 [英] JSON to JSON transformer

查看:92
本文介绍了JSON到JSON转换器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景。

所需的输入和输出是JSON。

Required input and output are JSON.

// Input
{
  "OldObject": {
    "Time": 1351160457922,
    "Name": "OName",
    "quantity": 100,
    "price": 10
  }
}


// Output
{
  "NewObject": {
    "Time": 1351160457922,
    "Title": "OName",
    "quantity": 100
  }
}

我需要一些转换代码或最好是xslt类型的语言来将json从一种格式转换为另一种格式。这个变压器也需要快速,因为转换将在运行中完成。



编辑

我没有收到的INPUT对象的定义可能会在运行时更改。但如果需要,我可以使用OUTPUT对象的类。
我试图将此作为 json - > xml - > xslt - > xml - > json ,但此时每秒接收大约1000个对象,此过程可能会产生开销。

我不能使用JavaScript,因为myApp是简单的基于Windows的java应用程序,使用JavaScript可能会导致开销。

I need some transformation code or preferably xslt type language to transform json from one format to another. This transformer also need to be fast as transformation will be done on the fly.

Edit
I don't have the definition of the INPUT object received and it might change at run time. but I can use class for OUTPUT object if needed. I have tried to do this as json -> xml -> xslt -> xml -> json, but approximately 1000 objects are received per second at this end and this process might incur overhead.
I can not also use JavaScript as myApp is simple windows based java application and using JavaScript might cause overhead.

推荐答案

您可以使用ZORBA和JsonIQ http://www.jsoniq.org/
但是,它是一个本地库,它带有一个包装器,所以你可以在java中使用它。

You can use ZORBA and JsonIQ http://www.jsoniq.org/ However, it's a native library, it comes with a wrapper so you can use it in java.

这篇关于JSON到JSON转换器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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