문제

I'm working with a webservice that returns data in JSON format and i'm pretty new at Pharo 2.0

¿is there a good, simple and most of all reliable JSON parser?

I saw the JSON parser example using PetitParser in the book "Pharo by example 2" (deep into pharo) but i don't know if it's just an illustrative example or something fully functional.

도움이 되었습니까?

해결책

You just have to take a look at NeoJSON. It's the best thing I know in Pharo to work with JSON.

다른 팁

I don't know NeoJSON, but this one works great: http://smalltalkhub.com/#!/~PharoExtras/JSON

both works, and also PetitJSON (no, it was not an example, is fully operational)

I know this question is some years old and relates to Pharo 2 but in the current version of Pharo (6.1) there is a class STONJSON in the STON-Core package which makes it easy to read and write data from and to JSON strings or streams:

| dict |

dict := STONJSON fromString: '
{ 
  "flow": "milk",
  "amount": 42.0
}'.
Transcript show: ( STONJSON toStringPretty: dict ).
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top