为什么我不能在LS中同时使用两个JSON库 [英] Why I can't use two JSON libraries at the same time in LS

查看:205
本文介绍了为什么我不能在LS中同时使用两个JSON库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Notes项目中使用JSON.我已经在这里为此下载了一个库 https://openntf.org/main.nsf/project.xsp?r=project/JSON%20LotusScript%20Classes .我从后端获得了JSON String,使用JSON进行了一些操作,稍后我需要将其解析回String.但不幸的是,我可以使用JSONReaderJSONWrapperConverters脚本.由于某些非常愚蠢的原因,无法同时使用两者.它给了我以下错误.

I need to use JSON in my Notes project. I've downloaded a library for it here https://openntf.org/main.nsf/project.xsp?r=project/JSON%20LotusScript%20Classes. I get a JSON String from back-end side, do some manipulations with JSON And later I need to parse it back into a String. But unfortunately, I can use either JSONReader or JSONWrapperConverters script. Cannot use both for some really stupid reason. It gives me the following error.

因此,我可以使用JSONReader解析字符串,也可以使用JSONWrapperConverters将其转换回字符串.很显然,我需要一起做这两个事情.问题是什么?为什么它不能同时使用2个库?

So I am able either to parse a string using JSONReader or cast it back to a string using JSONWrapperConverters. I need to do these 2 things together, obviously.. What is the problem? Why it cannot use 2 libraries at the same time?

推荐答案

该问题很容易解决. JSONReader的评论

The problem was easy to solve as hell. JSONReader's comment

'use the JSONWrapperConverters instead of JSONArray and JSONObject  if you need the ability to convert the JSONObject or JSONArray to a JSON string
'Use "ls.snapps.JSONWrapperConverters"
%REM
Copyright 2007, 2008, 2009, 2010 SNAPPS (Strategic Net Applications, Inc.)

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

    http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and limitations under the License.

%END REM

所以只需添加Use "ls.snapps.JSONWrapperConverters"代替

Use "ls.snapps.JSONArray"
Use "ls.snapps.JSONObject"

解决了问题.

这篇关于为什么我不能在LS中同时使用两个JSON库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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