Login  Register

Re: New Pharo user, some questions

Posted by dboeren on Dec 11, 2014; 3:33am
URL: https://forum.world.st/New-Pharo-user-some-questions-tp4795325p4795396.html

That's the next line of code after what I quoted:

"Parse the JSON data returned by the api"
data := NeoJSONReader fromString: response.

But, prior to the JSON parsing I was doing a couple of string replacements to patch up the data.  The system I'm moving the data into doesn't accept accented characters or bullets, and it wants empty strings instead of nulls.

All the JSON stuff works fine.  It's just the string operations with copyReplaceAll:with: that aren't working as expected for some reason.

Or are you saying that the data I get from from asUrl retrieveContents is not a "proper string" and maybe that's why it's not working?


On Wed, Dec 10, 2014 at 6:34 PM, Sven Van Caekenberghe <[hidden email]> wrote:

> On 10 Dec 2014, at 21:26, dboeren <[hidden email]> wrote:
>
>       "Fetch the raw JSON data from dtdb.co"
>       response := 'http://dtdb.co/api/cards/' asUrl retrieveContents asString.

Why no do

NeoJSONReader fromString: 'http://dtdb.co/api/cards/' asUrl retrieveContents

?

You'll get the data back, nicely parsed and converted to proper Pharo strings.

Sven