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e+tb75+f8BDQ0NDQ4NDhAQDhQWExYUHhsZGRseLSAiICIgLUQqMioqMipEPEk7NztJPGxVS0tVbH1pY2l9l4eHl761vvn5///AABEIBTQIWAMBIgACEQEDEQH/xACFAAEBAAMBAQEAAAAAAAAAAAAAAQIEBQMGBxABAAICAQMDAwMEAgIDAQADAAECAxEEBRIhEzFRFCJBFTJSI0JhcTNTJENygZFiJTShAQEBAQEBAAAAAAAAAAAAAAAAAQIDBBEBAQACAgIDAQEBAQEBAAAAAAECERITIVEDMUFhIjIjgVL/2gAMAwEAAhEDEQA/ANoE2yKbY7QGUyIbBWM31+WFrPGbbQes5YhhOTby0yiAXcykKaFDamtgppPMLACKRAGliFAQUBBkAw0x7XokgkQukiWQEQoAmiIUgGSaUBGSKKAoIKRAAGgUFBIjTIAVJUBF0KDGUhmAKABCgCgApEAAugQU0oMdCroE0mmWgGOjTNNAkKABpQECQEVPO1BBTQMVhQAABJZAMdGlUGOjTIBiqgIMkFY6TTMBjo0yAY6XSgJoUBBUkE15VYgBEirJRGOhkAxVSQYqKAACLBCgKADGWQCKAAKCKIAAAACCgAQoIKAgqAIqgmlEBQgAFARRQEBQAAABFF0DFQAVFBBRBBQEFFEUAAAE0oAAgAAigAAAKAgoDDbMAAAQXSAKAACgooICgIqAAACoAAAaUANAAAAAAAAigMZ2RKmgURQAAUABFQFAAAAAAABAUEFQBjMvLJaYidQ5mbPyv7KSuh19sbX1D5+2fqH8HjOXqF/7TVH0dcm3p3Q+exz1HX7Wzjx8+0+TVHZ2yamPHn/us24g0KKAhJLU5Fcto1STSNjug7nBy4edvxNnj6nMp+JB9J3bY98fL5q/J5cxqImGOSOZXWrzPgH0/ey7ny2GedN/O5h3cFM3ibmhvwEKgmmMs01CKAACiGwQUAAiQBQAAAQAFABFABQBEgAVABYUAABFAUAAAAAACAAAAkAAAAABAAAAYV/dIA9AAAAVAAAAAAQBVQAAEESQFIAB/9k=" ] 如何将其转换为数组?
虽然当我使用时,request.getParameterValues("jsondata");我得到这个值 [Ljava.lang.String;@8892fd8,这不是我想要的。如何转换为数组?
该jsondata值是JSON文本。它以#开头[,这意味着它是一个JSON数组。
要处理它,您应该使用JSON解析器。请参见如何在Java中解析JSON。
一旦你解析它,你应该有一个String[]或一个List ,有2个值。
两个值都data:image/jpeg;base64,以Base-64编码的二进制数据(JPEG图像)开始。
假设你有Java 8或更高版本,请使用Base64该类将其解码为a byte[]。
您现在拥有2个JPEG图像,采用2字节数组的形式。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。