dmcquay / node-apac

node-apac - Node.js client for the Amazon Product Advertising API, including support of Request Signatures
MIT License
499 stars 111 forks source link

Results returned are in XML format #72

Closed johnfoderaro closed 8 years ago

johnfoderaro commented 8 years ago

Firstly, I love this npm module. I was using it several months back on a project and recall that the results would be returned in JSON format (I do not recall which version I was running at that time). I just recently began testing a new project with this module (v 2.0.2) and am now realizing that the results are being returned in the XML format.

I've checked the docs over and over again and looked through closed issues here on GitHub, just to make sure I wasn't going crazy, imagining things. The closest thing I could find was issue https://github.com/dmcquay/node-apac/issues/45.

Is there anything specific to do to enable JSON formatted results?

francescotonini commented 8 years ago

Honestly I don't remember whether or not we had the possibility to parse the result as JSON (my first implementation of this module was sept. 2015). I know it's not the best solution, but you could use JSON.parse.

BTW JSON parse would be a nice feature.

dmcquay commented 8 years ago

I'm unavailable for a few days, but I'll take a look at this as soon as I get back. On Thu, Aug 11, 2016 at 12:13 AM Francesco Tonini notifications@github.com wrote:

Honestly I don't remember whether or not we had the possibility to parse the result as JSON (my first implementation of this module was sept. 2015). I know it's not the best solution, but you could use JSON.parse.

BTW JSON parse would be a nice feature.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dmcquay/node-apac/issues/72#issuecomment-239081167, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHIcQY2VZkN55C3JsYgswSM9D8fi0bkks5qer1ugaJpZM4JhwAY .

johnfoderaro commented 8 years ago

@dmcquay thank you. I will take a look at my previous project that had used the apac npm module. Also, I may be confusing the previous project's results with a JavaScript object instead of JSON. However I do recall needing to use the util module to "see" my results in the console during development and do not recall dealing with XML (either way, the module works). Thanks!

thaerlabs commented 8 years ago

@johnfoderaro the reponse object resolved has 2 keys result and responseBody. result is the JSON parsed response, and is the original XML responseBody.

johnfoderaro commented 8 years ago

@thaerlabs thank you for the clarification. I was looking at the wrong item. As I had a feeling, this wasn't an issue with the module but with the user :)

Also, taking a closer look at lib/operation-helper.js helped a ton.

dmcquay commented 8 years ago

Thank you Thaer. On Thu, Aug 11, 2016 at 5:39 PM John Foderaro notifications@github.com wrote:

@thaerlabs https://github.com/thaerlabs thank you for the clarification. I was looking at the wrong item. As I had a feeling, this wasn't an issue with the module but with the user :)

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/dmcquay/node-apac/issues/72#issuecomment-239325581, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHIcRK6JUrlf5-JZIfYPIvfrfIJ0A1Uks5qe7KvgaJpZM4JhwAY .