0

I have a reasonably large payload coming back via a java rest service as json (about 3,000 records of fairly lightweight objects). Jax-RS and JaxB are sorting out the json side for me, so I doubt it is an error in the json being returned.

The json file itself looks fine when I call the rest resource directly and view the payload in notepad++, and there are no rouge characters such as carriage returns etc in the underlying SQL tables.

SyntaxError: Unexpected token 
    at Object.parse (native)
    at ub (http://localhost:8080/misf-web/lib/angular/angular.min.js:13:122)
    at e.defaults.transformResponse (http://localhost:8080/misf-web/lib/angular/angular.min.js:98:83)
    at http://localhost:8080/misf-web/lib/angular/angular.min.js:97:347
    at Array.forEach (native)
    at n (http://localhost:8080/misf-web/lib/angular/angular.min.js:6:470)
    at Yb (http://localhost:8080/misf-web/lib/angular/angular.min.js:97:329)
    at c (http://localhost:8080/misf-web/lib/angular/angular.min.js:99:14)
    at i (http://localhost:8080/misf-web/lib/angular/angular.min.js:79:437)
    at http://localhost:8080/misf-web/lib/angular/angular.min.js:80:485 angular.min.js:63

I started to play around with the data. Deleting everything starting with A in a particular field, then B....to see if I could narrow it down to a particular set of records.

I got to deleting everything starting with S and the angular side started working.

So I reloaded the data. Deleted everything starting with S....and tried again, and it failed. So I suspect it is nothing to do with the Json being returned, but the size of the payload.

I appreciate I could use server side paging, but my concern is more around why isnt this working? I want to actually fully load the 3,000 objects into the application on application startup - but it isn't working....for no obvious reason that I can see.

Regards

--UPDATE: was advised to use JSONLINT.

Got this error:

Parse error on line 23:
...       "projectNm": "(Delete) A
-----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

Not sure I understand why, as it looks OK:

   {
    "approvedPriority": "UNKNOWN",
    "disease": "UNKNOWN",
    "diseaseArea": "UNKNOWN",
    "dpomBpomPhase": "UNKNOWN",
    "imed": "UNKNOWN",
    "jtastRanking": "UNKNOWN",
    "moleculeOrTypeOfProduct": "UNKNOWN",
    "planningStatus": "06-TO BE DELETED",
    "programCategoryDesc": "UNKNOWN",
    "projectCode": "UNKNOWN",
    "projectNm": "(Delete) Analytical Productivity (Delete)",
    "projectSk": 562,
    "projectType": "UNKNOWN",
    "therapyArea": "UNKNOWN"
},

UPDATE 2:

OK, database value looks fine. However when I copy the value from the json results into a text editor, the process of getting it returned over the wire by JaxB has introduced rogue characters....so I have a record with "My - Name" and when I copy the value out into notepad++ it says "My !! Name" with some weird character introduced to replace the " - ". Other values with hyphens have come over fine. The record is fine at the DB end...whats happening here? Why would Jersey decide to mangle some of the outputs??

UPDATE 3:

Looping through the characters in one of the offending items. What looks like a " - " in the database, when pasted into Excel and having the Ascii characters examined is coming up with ASCii code 150 which is a non printable character??

http://www.theasciicode.com.ar/extended-ascii-code/letter-u-circumflex-accent-u-circumflex-ascii-code-150.html

i

smackenzie
  • 2,880
  • 7
  • 46
  • 99
  • 1
    not likely a size issue as far as browser is concerned. Inspect the full body of request in network tab of browser dev tools/console and pasted it into jsonlint.com to see where it is invalid – charlietfl Aug 04 '14 at 17:01
  • I'll second @charlietfl's suggestion for putting the data into jsonlint. But, you should use an un-minified version of angular for debugging. Hopefully it'll give you less cryptic stack traces. – Tony Aug 04 '14 at 17:57
  • Thanks, although not sure I see the issue Jsonlint is flagging: Parse error on line 23: ... "projectNm": "(Delete) A -----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[' Are you not allowed to have an opening bracket in the text value of an object...!? – smackenzie Aug 05 '14 at 15:58

0 Answers0