我正在使用ColdFusion 2016,下面是我正在做的事情:
<cfhttp method="put" url="https://www.colorfulapi.com/testpage/#arguments.Name#" username="#request.APIusername#" password="#request.APIToken#" result="results">
<cfhttpparam type="header" name="Content-Type" value="application/json">
<cfif isStruct(arguments.structform) AND !StructIsEmpty(arguments.structform)>
<CFHTTPPARAM VALUE="'#serializeJSON(stFields)#'" TYPE="body">
</cfif>
</cfhttp>st是这样的:如果我甩了他们
'{"ONE":{"GROUP":"my group"}}'如果它使用serializeJSON转到cfhttpparam,它会向我显示如下:
"error":"JSON error: 822: unexpected token at ''{\"ONE\":{\"GROUP\":\"my group\"}}''"}我在POSTman中尝试了相同的代码,但是在POSTman中,对于JSOn发送,我必须使用主体作为原始,选择内容作为application/json,并且它在那里工作。
我就是这样生成我的stFields的
<cfset stFields = StructNew()>
<cfset stFields.one = arguments.structform>
<cfdump var="'#serializeJSON(stFields)#'"> https://stackoverflow.com/questions/42165514
复制相似问题