Malformed Json Syntax exception android

this is the server response

[{bookmark={}, comments=[], createdOn={date=7.0, day=5.0, hours=14.0, minutes=0.0, month=2.0, nanos=0.0, seconds=0.0, time=1.3942008E12, timezoneOffset=0.0, year=114.0}, event={}, fileContentType=, fileName=, fileSize=0.0, fileUrl=, hasFile=0.0, image={}, isCommented=0.0, isLike=false, isOnlyMe=false, isPolled=false, isRsvp=false, isSpamed=0.0, ismoderated=0.0, keywords=[], meetingId=0.0, modifiedOn={date=7.0, day=5.0, hours=14.0, minutes=0.0, month=2.0, nanos=0.0, seconds=0.0, time=1.3942008E12, timezoneOffset=0.0, year=114.0}, originalId=0.0, parentId=0.0, parentPost=, parentPostCreatedOn={date=7.0, day=5.0, hours=14.0, minutes=0.0, month=2.0, nanos=0.0, seconds=0.0, time=1.3942008E12, timezoneOffset=0.0, year=114.0}, parentPostUserEmailAddress=, parentPostUserId=0.0, parentPostUserName=, pollOptions=[], post=Hi All,~|~~|~We have provided MMv3 User Guide on below location~|~URL: http://mmv3.qlc.co.in/ms/MMv3_Help/MailServe_v3.00.html~|~~|~Please provide us your suggestions and feedback., postId=39629.0, postShareWithId=[], postType=1.0, postUserId=100021.0, postVisibility=0.0, selectedPollOption=0.0, selectedRsvp=0.0, sourceId=449.0, sourceName=All QLC, sourceType=2.0, tag=[], tagId=[], tags= , user={address=, blogSiteUrl=, certificates=, college=, connectionCount=0.0, created={}, description=, emailAddress=ashwini.nimbargi@qlc.in, facebookProfile=, firstName=Ashwini, groupCount=0.0, highestDegree=, id=0.0, lastName=Nimbargi, linkedInProfile=, locationId=0.0, mobileNumber=0.0, modified={}, nickName=Ashwini Nimbargi, otherPhone=0.0, password=, pinCode=0.0, previousEmployer=, twitterProfile=, type=0.0, university=, userCommunityId=0.0, userId=100021.0, userPreference={}, website=}, userFile={}, video={}, wallPostSummary={commentCount=0.0, likeCount=4.0, modifiedOn={date=7.0, day=5.0, hours=14.0, minutes=0.0, month=2.0, nanos=0.0, seconds=0.0, time=1.3942008E12, timezoneOffset=0.0, year=114.0}, postId=39629.0, spamCount=0.0, wallPostSummaryId=29777.0}}, {bookmark={}, comments=[], createdOn={date=7.0, day=5.0, hours=12.0, minutes=44.0, month=2.0, nanos=0.0, seconds=31.0, time=1.394196271E12, timezoneOffset=0.0, year=114.0}, event={}, fileContentType=, fileName=, fileSize=0.0, fileUrl=, hasFile=0.0, image={}, isCommented=0.0, isLike=false, isOnlyMe=false, isPolled=false, isRsvp=false, isSpamed=0.0, ismoderated=0.0, keywords=[], meetingId=0.0, modifiedOn={date=7.0, day=5.0, hours=12.0, minutes=44.0, month=2.0, nanos=0.0, seconds=31.0, time=1.394196271E12, timezoneOffset=0.0, year=114.0}, originalId=0.0, parentId=0.0, parentPost=, parentPostCreatedOn={date=7.0, day=5.0, hours=12.0, minutes=44.0, month=2.0, nanos=0.0, seconds=31.0, time=1.394196271E12, timezoneOffset=0.0, year=114.0}, parentPostUserEmailAddress=, parentPostUserId=0.0, parentPostUserName=, pollOptions=[], post=t, postId=39627.0, postShareWithId=[], postType=1.0, postUserId=100220.0, postVisibility=0.0, selectedPollOption=0.0, selectedRsvp=0.0, sourceId=449.0, sourceName=All QLC, sourceType=2.0, tag=[], tagId=[], tags= , user={address=, blogSiteUrl=, certificates=, college=, connectionCount=0.0, created={}, description=, emailAddress=pankaj.sharma@qlc.in, facebookProfile=, firstName=Pankaj, groupCount=0.0, highestDegree=, id=0.0, lastName=Sharma, linkedInProfile=, locationId=0.0, mobileNumber=0.0, modified={}, nickName=Pankaj Sharma, otherPhone=0.0, password=, pinCode=0.0, previousEmployer=, twitterProfile=, type=0.0, university=, userCommunityId=0.0, userId=100220.0, userPreference={}, website=}, userFile={}, video={}, wallPostSummary={commentCount=0.0, likeCount=0.0, modifiedOn={date=7.0, day=5.0, hours=12.0, minutes=44.0, month=2.0, nanos=0.0, seconds=31.0, time=1.394196271E12, timezoneOffset=0.0, year=114.0}, postId=39627.0, spamCount=0.0, wallPostSummaryId=29775.0}}]

when i try to parse it i get the exception

com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unexpected value at line 1 column 198

this is my java code

Log.e(TAG, fromJson.getResponse().getResult().toString());

            WallPost[] fromJson2 = gson.fromJson(fromJson.getResponse().getResult().toString(), WallPost[].class);
//
            Log.e(TAG, "length: "+fromJson2.length);

Answers


try this

Gson gson = new Gson();
Type collectionType = new TypeToken<Collection<WallPost>>(){}.getType();
Collection<WallPost> collObj = gson.fromJson(gson.toJson( obj.Data), collectionType);
List<WallPost> lst = new ArrayList<WallPost>(collObj);

refer from : https://sites.google.com/site/gson/gson-user-guide#TOC-Array-Examples


Need Your Help

How to add clickable links inside a popup, in Bootstrap

twitter-bootstrap

I have had no luck in finding a solution to this, on Google.

Mysql database, can't connect

php mysql

I've had this problem before, but I can't remember how I got over it. Basically I have a code something like this: