以JSON格式显示计算文本

时间:2015-07-27 08:33:10

标签: xpages xpages-ssjs

在一个xpage中,我有几次调用,通过java类文件从几个notesview中收集json格式的数据。

要检查或可视化数据,我有一个"调试模式"选项以在计算字段中显示此数据。

数据是json但我希望它在计算文本中格式化,因此更容易阅读。

有谁知道如何将显示格式化为更容易阅读而不是一行文字?

e.g。从

{"locationName":"","gender":"Male","companyName":"","name":"Patrick Kwinten","docUNID":"845AB7AF45FF1260C1257E88003DACFA","notesName":"CN=Patrick Kwinten\/O=quintessens","branchName":"Quintessens Global Services","phone": ["+49 1525 161 223"],"info": ["IT Specialsit"],"sourceUNID":"","pictureURL":"http:\/\/dev1\/apps\/banking\/ServiceData.nsf\/0\/845AB7AF45FF1260C1257E88003DACFA\/$FILE\/PortalPicture.jpg","mail": ["patrickkwinten@ghotmail.com"],"reportsTo":"CN=Eva Fahlgren\/O=quintessens","job":"Managaer","departmentName":"Collaboration Services"}

{
  "locationName": "",
  "gender": "Male",
  "companyName": "",
  "name": "Patrick Kwinten",
  "docUNID": "845AB7AF45FF1260C1257E88003DACFA",
  "notesName": "CN=Patrick Kwinten\/O=quintessens",
  "branchName": "Quintessens Global Services",
  "phone": [
    "+49 1525 161 223"
  ],
  "info": [
    "IT Specialsit"
  ],
  "sourceUNID": "",
  "pictureURL": "http:\/\/dev1\/apps\/banking\/ServiceData.nsf\/0\/845AB7AF45FF1260C1257E88003DACFA\/$FILE\/PortalPicture.jpg",
  "mail": [
    "patrickkwinten@ghotmail.com"
  ],
  "reportsTo": "CN=Eva Fahlgren\/O=quintessens",
  "job": "Managaer",
  "departmentName": "Collaboration Services"
}

1 个答案:

答案 0 :(得分:0)

我以不同的方式做到这一点。我使用Google Postman来触发请求(带有标题或任何你需要的东西),然后我将结果返回给Postman并将其视为"漂亮" - 这样我就不必在应用程序中构建这样的东西了 - 我也更喜欢看到" raw"数据,而不是冒险改变任何操纵它的方式,然后按照你的建议显示: - )

一旦我发现它,它真的不能没有这个实用程序。

/约翰