GeoffreyB Posted June 10, 2010 Share Posted June 10, 2010 I am writing an PHP web application which is to accept data from a desktop application process it and return a result set. As this process will be happening at very regular interval and the speed of transmit-process-transmit process is vital I have chosen to use JSON encoding of data to keep it lightweight. What I need to send is in the form of multi-dimensional arrays The issue that I am having is with my testing. To emulate the desktop application I create the multi-dimensional array in PHP, encode it with the json_encode function and send it to the server to be processed. As I was not getting the results I expected I echoed and var_dumped at different stages in the process. Straight after the json_encode I echo a perfectly formed json object but when I echo it after retrieving from $_REQUEST on the server the json object is only part there. Before [{"contenderid":1,"CareerStarts":"7","API":"10523","AvSP":"2.30","CavSP":"2.45","#AvSP":"2.35","#CavSP":"2.50","SP1":"2.45","SP2":"2.50","SP3":"2.55","OP1":"6.00","OP2":"5.60","OP3":"7.80","CurrentBF":"1.95","CurrentNSW":"2.10","CurrentUNI":"2.65","CurrentVic":"1.90","SPBracket":"1","Delta":"0.65","Lean":"+9","Lean+":"10.35","Lean++":"12.24","GDSLean":"3.0","ZeroRank":"1","ZeroSPStats":"","FocusFrameChange":"","FocusFrameRecent":"","FocusFrameStars":"2","FocusFrameSum":"","BDGConsectutiveYellow":"3","BDGPercentageDrop":"28","BDG_BFUnderTote":"5","BDGYellowCount":"4","AvWWD":"52.5","WgtCh":"1.5","Wgt":"51","A":"3","X3":"","X4":"","Z":"","C#":"","G#":""},{"contenderid":2,"CareerStarts":"10","API":"15793","AvSP":"2.75","CavSP":"2.70","#AvSP":"2.75","#CavSP":"2.70","SP1":"2.45","SP2":"2.60","SP3":"2.90","OP1":"6.00","OP2":"5.60","OP3":"7.80","CurrentBF":"3.20","CurrentNSW":"3.00","CurrentUNI":"3.65","CurrentVic":"2.90","SPBracket":"1","Delta":"0.98","Lean":"+13","Lean+":"12.90","Lean++":"14.73","GDSLean":"4.0","ZeroRank":"2","ZeroSPStats":"","FocusFrameChange":"","FocusFrameRecent":"","FocusFrameStars":"2","FocusFrameSum":"","BDGConsectutiveYellow":"3","BDGPercentageDrop":"28","BDG_BFUnderTote":"5","BDGYellowCount":"4","AvWWD":"0.5","WgtCh":"0.5","Wgt":"54","A":"4","X3":"","X4":"","Z":"","C#":"","G#":""}] After [{"contenderid":1,"CareerStarts":"7","API":"10523","AvSP":"2.30","CavSP":"2.45"," Is there any suggestions to what is going wrong here. Why is the json object string being truncated? Link to comment https://forums.phpfreaks.com/topic/204341-json-encoding-multi-dimensional-arrays/ Share on other sites More sharing options...
kenrbnsn Posted June 10, 2010 Share Posted June 10, 2010 The "#" in the string is stopping the URL. Use urlencode on the string when putting it into the URL. Ken Link to comment https://forums.phpfreaks.com/topic/204341-json-encoding-multi-dimensional-arrays/#findComment-1070156 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.