[sf-perl] REST data parsing

David Alban extasia at extasia.org
Tue Sep 7 17:25:37 PDT 2010


greetings,

i know little about REST.  i've been told that this example string is
rest data, something returned by some RESTful process:

{"FraudCheckMonitorResults":"TrinityCheck":1,"AccertifyCheck":1,"NumRetryListings":1,"NumRetryOrders":1,"NumPurchasedStuckOrders":1,"NumAcceptedListings":1,"NumAcceptedOrders":1,"NumRejectedListings":1,"NumRejectedOrders":1,"NumReviewedListings":1,"NumReviewedOrders":1}}

a local java developer asked me (the local perl guy) how to get this
string into a perl data structure.  when i asked, he confirmed he
wanted something like this:

FraudCheckMonitorResults => {
  TrinityCheck            => 1,
  AccertifyCheck          => 1,
  NumRetryListings        => 1,
  NumRetryOrders          => 1,
  NumPurchasedStuckOrders => 1,
  NumAcceptedListings     => 1,
  NumAcceptedOrders       => 1,
  NumRejectedListings     => 1,
  NumRejectedOrders       => 1,
  NumReviewedListings     => 1,
  NumReviewedOrders       => 1,
};

i was about to code it when i asked if this was a standard data
format, thinking why should i reinvent this particular wheel?  maybe
cpan has something.  i was told it was REST data.  but my impressive
lack of knowledge about REST is not helping.  i took a brief look on
search.cpan.org.  i'll keep looking, but i haven't found anything yet
that looks like it might deal with the kind of string above.

questions:

* is the string at the top of the email REST data?
* if so, are there cpan libraries with routines that will parse these
kind of strings, resulting in the kind of data structures shown above?

thanks,
david
-- 
Live in a world of your own, but always welcome visitors.


More information about the SanFrancisco-pm mailing list