You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Notes项目中无法同时使用两个JSON LotusScript类库的问题求助

Fixing JSON Library Conflict in Your Notes Project

Hey there! Let's work through that conflict between JSONReader and JSONWrapperConverters in your LotusScript JSON setup. I've dealt with this exact issue using the same library, so here's what you need to know:

Why You're Seeing the Conflict

The two components rely on separate internal parsing/serialization contexts—mixing them tries to reuse or overwrite shared resources, which triggers errors. The fix is to pick one consistent workflow for parsing and serializing, no mixing allowed.

Option 1: Stick with JSONReader + JSONWriter

This is the more straightforward approach for direct JSON object manipulation:

  1. Parse the incoming string into a JsonObject or JsonArray using JSONReader:
    Dim jsonReader As New JSONReader()
    Dim jsonObj As JsonObject
    Set jsonObj = jsonReader.ParseString(yourJsonString)
    
  2. Modify the JSON object as needed (add/update fields, adjust arrays):
    jsonObj.Put("updatedField", "newValue")
    jsonObj.Remove("oldField")
    
  3. Serialize back to string using JSONWriter:
    Dim jsonWriter As New JSONWriter()
    Dim outputJson As String
    outputJson = jsonWriter.WriteToString(jsonObj)
    

Don't forget to clean up your objects with Set jsonReader = Nothing and Set jsonWriter = Nothing when done to avoid lingering context issues.

Option 2: Use JSONWrapperConverters Exclusively

If you prefer working with wrapped objects (which can feel more "Notes-like"), stick to the converter methods end-to-end:

  1. Parse the string into a wrapped JSON object:
    Dim converter As New JSONWrapperConverters()
    Dim wrappedObj As JSONWrapperObject
    Set wrappedObj = converter.JsonStringToWrapper(yourJsonString)
    
  2. Manipulate the wrapped object:
    Call wrappedObj.Put("newKey", "updatedValue")
    Call wrappedObj.Delete("obsoleteKey")
    
  3. Convert back to string:
    Dim outputJson As String
    outputJson = converter.WrapperToJsonString(wrappedObj)
    

Pro Tips

  • Make sure you're using the latest version of the JSON LotusScript Classes—older versions had more context-related bugs that caused this kind of conflict.
  • If you ever need to convert between the two object types, use the converter's helper methods instead of trying to mix readers/writers directly.

内容的提问来源于stack exchange,提问作者J.Nick

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:10:53