VBA JSON在TXT中的日志&引用;
我完成了向API发送请求并以JSON格式获得回复的宏。然后将结果返回到工作表(“结果”)。我还创建了单独的日志文件。问题是输出不是标准JSON格式,如:VBA JSON在TXT中的日志&引用;,json,excel,vba,phrase,Json,Excel,Vba,Phrase,我完成了向API发送请求并以JSON格式获得回复的宏。然后将结果返回到工作表(“结果”)。我还创建了单独的日志文件。问题是输出不是标准JSON格式,如: { "title": "Example Schema", "type": "object", "properties": { "firstName": { "type": "string" },
{
"title": "Example Schema",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "lastName"]
}
但有“需要excel”双引号:
"{
""title"": ""Example Schema"",
""type"": ""object"",
""properties"": {
""firstName"": {
""type"": ""string""
},
""lastName"": {
""type"": ""string""
},
""age"": {
""description"": ""Age in years"",
""type"": ""integer"",
""minimum"": 0
}
},
""required"": [""firstName"", ""lastName""]
}"
我的宏看起来像(位截断):
要删除双引号,我需要更改什么
非常感谢 此选项将双引号替换为单引号
Dim findChars, replaceChars As String
findChars = """"""
replaceChars = """"
Replace(ObjHttp.responseText, findChars, replaceChars)
当我写#FF,Replace(ObjHttp.responseText,Chr(34),“”)时查找,这将完全删除文本中的所有引号。。。当我尝试写入#FF,Replace(ObjHttp.responseText,Chr(34)和Chr(34),Chr(34))时,这不会起任何作用…请使用Print#FF,ObjHttp.responseText
而不是Write
。
Dim findChars, replaceChars As String
findChars = """"""
replaceChars = """"
Replace(ObjHttp.responseText, findChars, replaceChars)