2015-10-01 71 views

回答

0

只需簡單地解析您的JSON字符串。像那樣。

var response = { 
    "GetIPAResult": "{\"Data\":[{\"Name\":\"Pan1\",\"Email\":\"[email protected]\"},{\"Name\":\"Pan2\",\"Email\":\"[email protected]\"}]}" 
}; 

var result = $.parseJSON(response.GetIPAResult); 

現在你可以不回斜線讓你的數據(結果變量)。

+0

感謝的Sohel結果。我們使用Mule和mule使用Rhinoscript。 Neverthless我插入這個,但得到如下錯誤異常堆棧是: 1.語法錯誤:意外的標記:u(<未知的源代碼>#5)(sun.org.mozilla.javascript.internal.EcmaError) sun.org。 mozilla.javascript.internal.ScriptRuntime:3770(null) – hpandalai

0

哈日..在那一刻你的JSON結構如下所示

{"key": "value"}

其中value爲{ 「數據」:JSONARRAY}的字符串化

這裏2例出現..

案例1: 嘗試返回JSON的結構改變爲

{"key": JSONOBJECT} where JSONOBJECT -> {"DATA": JSONARRAY}

案例2:

嘗試返回JSON 「 {與{\」 轉換爲

{"key": JSONOBJECT} where JSONOBJECT -> {"DATA": JSONARRAY}

通過更換}」}

因此的

{ 
"GetIPAResult": "{\"Data\":[{\"Name\":\"Pan1\",\"Email\":\"[email protected]\"},{\"Name\":\"Pan2\",\"Email\":\"[email protected]\"}]}" 
} 

{ 
"GetIPAResult": {"Data":[{"Name":"Pan1","Email":"[email protected]"},{"Name":"Pan2","Email":"[email protected]"}]} 
}