ECNU_DF
ECNU_DF
采纳率0%
2016-05-17 10:59 阅读 4.4k

angularjs中使用json.stringify()字符串后得到的json对象结果不完整

$scope.upLoad = function() {
var emImage = "P7DIrESP56EzCdZ57e0gLgjIwMS8TARUavjVGnRqdWiqqEGgvQ0SzzXOjMO5qxZDH5HM/mq5G9B+pADujmZ0VpKB/g6sXFWBoCEN972yHLtevxZqtYSakgr8bUMsqls1HQat/JDfLy/WatWJAY6ORqM6j35w3YkA/MGZxWgV7VCr685taTEstNUrJqhWqZCXlQZZo4WKssFN+yrXWhHY+SnPAbu1EiLuSMWI6VORf/EMaPWR7KOJu457OGSfhJLPt8KaMhqRcVrsf/0ORMcnYc/uWrz/pYyKZgPik2Ox8LYzMGFCHLZvr8TvH9vhKyoqFA/42u0/AZY0a9YstWhBc3OzsDI4HA6VyWSSDQaD0eVyzfJqNC/ldXUl/L+6Glj8AXC0kZOZSrA0UKn1dERq1F0YDftj2xGAH0JorZ1ixAU35sCns2DW7UIN6HtZZubRjO5mL8Kj09DVuAkH3n4EEdExaOlQQ5N5ERlrhO3LVzD56rkYMToWZQcbcPVNqyGptHF79+5t/jq0vlOwGKpnMxpdLMvyrykFKG16Hj/4GGoMr0N4eLi4AB38/EJdfdilc7lCKJ67rM9cGAiM/+ksEJuyHNqi4uJ6NyEcMz4Yuktpr75eAUY3ggS5o1zTiicOdiB1lRO6UOFxwx92IyPoVb7BxdyIYqMCG5x9G5Z5CJCZbEJuiwYgZ0/Hia7VY8tQmnDklDNeeHYbmxgBe2J+MbmewsqS4cNj3Chaj2pGLLro444EHHlSAYeJ79H2NjY3K561btqG9vQMRkeG48UbhOygTAkSndxP3eWQjGrbcDb9tHfQ6Hc1YiQ3KpjWGQ6eNhdNRRRD67vv8wwZ0hRkw/fyxGHfVcppdE/yuEvjtxQh466DXq7DjkwPY+/46xGdaYHPo8MTfq2DUANdeZMXsyWr4PDJe3GZFUZ3WY9AGlzEr+HVJSQlVct/2nZmhAOv88y9QwAqjmOzPLOGvBHb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ohQuextBCjDg6BEepcPyJ+oRNJIrGh8Wrf0zjJHp2PLamyjatg6jx8QjOT2VGYCRuxYvvteIFZ86gtSJIqyPIWBFQwIrJy/vgyk+zyVnsT7upikIha5yOxV1LfGp+Xffg8RFizFjzJhTBmvFhvXwP/VXlC5dirMTosiMcD47BJZgGUWqVg9HUEZ3Yho8qz+m4+7ANrZBZJ67o4CfZYdh2kVZCLdGIm5YEuJZRNy3/QB2fWXDpLxYJGUnw5KVDktyNv5y/Z0s3TDSJmoQFqEmeTWIsEQgIS4SlS1qrNj";
console.log("emImage>>>>>>>>>>>>>>>>>" + emImage);
var requestdata = JSON.stringify({
"base64File": emImage
});
console.log("requestdata>>>>>>>>>>>>>>>>>" + requestdata);
}

结果1:
[INFO:CONSOLE(177)] "emImage>>>>>>>>>>>>>>>>>P7DIrESP56EzCdZ57e0gLgjIwMS8TARUavjVGnRqdWiqqEGgvQ0SzzXOjMO5qxZDH5HM/mq5G9B+pADujmZ0VpKB/g6sXFWBoCEN972yHLtevxZqtYSakgr8bUMsqls1HQat/JDfLy/WatWJAY6ORqM6j35w3YkA/...............................................................
vgyk+zyVnsT7upikIha5yOxV1LfGp+Xffg8RFizFjzJhTBmvFhvXwP/VXlC5dirMTosiMcD47BJZgGUWqVg9HUEZ3Yho8qz+m4+7ANrZBZJ67o4CfZYdh2kVZCLdGIm5YEuJZRNy3/QB2fWXDpLxYJGUnw5KVDktyNv5y/Z0s3TDSJmoQFqEmeTWIsEQgIS4SlS1qrNj

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
结果2:
[INFO:CONSOLE(181)] "requestdata>>>>>>>>>>>>>>>>>{"base64File":"P7DIrESP56EzCdZ57e0gLgjIwMS8TARUavjVGnRqdWiqqEGgvQ0SzzXOjMO5qxZDH5HM/mq5G9B+pADujmZ0VpKB/g6sXFWBoCEN972yHLtevxZqtYSakgr8bUMsqls1HQat/JDfLy/WatWJAY6ORqM6j35w3YkA/...............................................vgyk+zyVnsT7upikIha5yOxV1LfGp+Xffg8RFizFjzJhTBmvFhvXwP/VXlC5dirMTosiMcD47BJZgGUWqVg9HUEZ3Yho8qz+m4+7ANrZBZJ67o4CfZYdh2kVZCLdGIm5YEuJZRNy3/QB2fWXDpLxYJGUnw5KVDktyNv5y/Z0s3TDSJmoQFqEmeTWI

JSON.stringify后得到的对象不完整,结果最后少一部分求赐教!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • weixin_42225324 Cynicism ° 2019-07-30 10:24

    我也碰到了,小程序上面用的时候他直接给我吧user_id忽略了。。忽略了
    var str = JSON.stringify(data);
    console.log(data)
    if(str.indexOf("user_id")!=-1){
    if(data.user_id == undefined || data.user_id == null){
    wx.showToast({
    title: '您的登录信息异常,无法进行操作',
    icon: 'none',
    duration: 3500
    })
    return
    }
    }

    点赞 评论 复制链接分享

相关推荐