Home › Forums › JavaScript › Working With JSON APIs
- This topic is empty.
-
AuthorPosts
-
October 6, 2014 at 9:50 am #185568
KKHAN
ParticipantHi guys,
I want to retrieve data via JSON API. I’ve done this previously with PHP and found out this is probably not the best way as a client side scripting language would be better for this.
I am asking what is the best framework to learn to help me with this? I’ve really been wanting to learn Anjular JS and just wondering if this framework will help me specifically with this. If you could provide some resources/tutorials on this type of work, it would be great.
Thanks.
October 6, 2014 at 11:21 am #185573shaneisme
ParticipantA JSON document is just an object in Javascript. So if you’re working with Javascript, just do something like this:
October 6, 2014 at 11:27 am #185575KKHAN
ParticipantI know what a JSON object is, as i have said i have retrieved the information already using php. I think you’ve completely misunderstood or not read properly what i am asking for.
What i am asking is whats the best practice.
October 6, 2014 at 11:28 am #185576shaneisme
ParticipantBest practice to do what?
I want to retrieve data via JSON API. I’ve done this previously with PHP and found out this is probably not the best way as a client side scripting language would be better for this.
Best practice to retrieve data? Just use the object…
October 6, 2014 at 11:31 am #185577KKHAN
ParticipantHighlighting 5 words, doesent make up my question. I am talking about frameworks to help me retrieve JSON data via a HTTP API.
October 6, 2014 at 11:33 am #185579shaneisme
ParticipantI’m saying you don’t need a framework… any framework or back-end language can handle it.
October 6, 2014 at 11:34 am #185580KKHAN
ParticipantI assume it was obvious i am wanting to use front end, as i have posted in the Javascript discussion forum, maybe i could have made that more clear. :)
October 6, 2014 at 11:35 am #185581Alen
ParticipantIf you want to learn Angular JS, you can do it with dummy data. But if you’re interested in bulding API, that’s a backend issue. And it doesn’t really matter what language backend is in, you just need to make sure that your response is a json object.
So if you request
example.com/resources
you would only get a json representation of the data.I like Laravel framework, if you’re interested there is a series about bulding API at Laracasts.com
October 6, 2014 at 11:36 am #185582KKHAN
ParticipantI am saying i want to know what a good framework is for a big project. My question wasent whether i needed it or not. This was not a quick answer you were hoping for i am sure.
October 6, 2014 at 11:38 am #185583KKHAN
ParticipantI am not building APIs. Not sure where you got that from. I am wanting to retrieve JSON data via APIs using a Javascript framework and i was wondering if anyone knew a good framework to do this with. I was interested in AnjularJS and wanted to see if anyone knew whether this framework specifically handles it better than alternatives.
October 6, 2014 at 11:45 am #185584Alen
ParticipantAngular is designed to work with json data in mind so yes it’s a great choice.
October 6, 2014 at 11:50 am #185587KKHAN
ParticipantThank you, I noticed you also referenced laracast and i love there tutorials. My follow up question now is do you know any good resources/tutorials on AnjularJS where they retrieve/Manipulate json api url/http data. As it is fairly new territory to me.
October 6, 2014 at 12:03 pm #185588Alen
ParticipantYou need to use Angulars $http service to make the request.
EDIT bellow
resources/tutorials on AnjularJS where they retrieve/Manipulate json api url/http data
This is a loaded question, there are many interrelated parts and concepts you need to understand about Angular. I suggest you read little bit more about it. There are many free resources. Including free YouTube tutorials and talks.
You asked about “best practice”… in this case for example I would create a Service and Factory to get the appropriate data. But that entails you understanding dependency injection (which Angular is good at) but you still need to understand what’s going on.
October 6, 2014 at 12:38 pm #185590KKHAN
Participant@Alen, thats awesome man ty.
For doing specifically what i wanted i found a good tutorial on pluralsight he covers $http in lesson 205.
I’ve been to a few popular tutorial sites i go to and the course on this particular site seemed the best as it assumes no prior knowledge of angujarjs. I will deffi be going through the entire course.
October 6, 2014 at 3:07 pm #185598__
ParticipantIf you want to learn Angular, then great! Go ahead. Yes, it handles JSON just fine.
All in all, though, I’m with @shaneisme. If you’re looking for the most straightforward solution, it’s not a framework: it’s just ajax (or however you access the api) and
JSON.parse
. -
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.