My json file that have data
[
{
"id": 19,
"name": "Science",
"quiz": "quiz6"
},
{
"id": 21,
"name": "general knowledge",
"quiz": "For banking"
},
{
"id": 26,
"name": "Technologies",
"quiz": "arithmatic"
},
{
"id": 27,
"name": "english",
"quiz": "abcde"
},
{
"id": 28,
"name": "computer",
"quiz": "basic Question"
}
]
save on a server.Now i want to parse it in phonegap(android).How to do that.
When I save that file on my project and use it then it work, but when i use that file directly on server site then its not working.Is there any permission or plugin needed to access json on server side.
If in url i pass the "http://some folders/places.php" then it not work.
Thanks to all. Its working now.I try it on phone and its working.Actually my AVG software block my emulator to access the internet. Thats why it was not working.
Related
I am trying to make an app showing info from an API. I have searched everywhere but I didn't find an answer that solve my problem!
Here is an example from the JSON file:
{
"status": 200,
"data": {
"date": "2018-10-12T00:00:00.000Z",
"featured": [
{
"id": "5bbdc3abdf819b65ea6b733b",
"name": "Name",
"price": "1",
"priceIcon": "priceicon",
"priceIconLink": "price.png",
"images": {
"icon": "icon.png",
"png": false,
"gallery": false,
"featured": false
},
"rarity": "rarity",
"type": "type",
"readableType": "Type"
}
]
}
}
How can I fetch the name, price, icon, rarity and readableType?
Please don't mark it as duplicate because I haven't found the answer that I am searching for.
Check this tutorial, no one is going to code it for you, also your question has been made 10000 times
Tutorial
I have a problem when I hit the backend API, I found a difference result on Postman and AsyncTask (httpPost). Why does it happen?
I use the multer-s3-transform nodejs plugin to upload the files into my backend API's, then stored on digitalocean spaces.
Below is a result from AsyncTask:
{
"fieldname":"user_photo",
"originalname":"IMG-20180308_0938_55321.jpg",
"encoding":"7bit",
"mimetype":"application/octet-stream",
"size":84289,
"bucket":"mycdn",
"key":"1e9440387181846f54bece8a5d95a8a9",
"acl":"public-read",
"contentType":"image/jpeg",
"metadata":null,
"location":"https://mycdn.sgp1.digitaloceanspaces.com/1e9440387181846f54bece8a5d95a8a9",
"etag":"\"91ff71e41380602dbc35c94100f88d80\""
}
And this is one from PostMan:
{
"fieldname": "user_photo",
"originalname": "my-photos.png",
"encoding": "7bit",
"mimetype": "image/png",
"transforms": [
{
"id": "or",
"size": 109955,
"bucket": "mycdn",
"key": "users/1520907984802.png",
"acl": "public-read",
"contentType": "image/png",
"metadata": null,
"location": "https://mycdn.sgp1.digitaloceanspaces.com/users/1520907984802.png",
"etag": "\"8e161cab4c516b5eb48c3c1c66987de9\""
}
]
}
My final question, why is the transforms array not showing up in my AsyncTask result?
I'm trying to set up CI for Gradle based Android project with Bamboo. Tutorial here work just work great for successful build.
For release note following I figure out to get Git log between two revision number.
git log ${bamboo.repository.previous.revision.number}..${bamboo.repository.revision.number}
But how to get last successful build git_revision number & current one.
Any suggestion ?
This involves scripting and utilizing REST API of Bamboo https://docs.atlassian.com/bamboo/REST [Choose the version you are working with]
To get all the build results, you need to make a call to:
[GET] <basepath>/rest/api/latest/result/{projectKey}-{buildKey}
Where, basepath is http://myhost.com:8085 OR http://myhost.com:8085/bamboo
Resulting in below:
{
"results": {
"size": 8,
"expand": "result",
"start-index": 0,
"max-result": 25,
"result": [
{
"link": {
"href": "<basepath>/rest/api/latest/result/{projectKey}-{buildKey}-{buildNumber}",
"rel": "self"
},
"plan": {
"shortName": "xyz",
"shortKey": "{buildKey}",
"type": "chain",
"enabled": true,
"link": {
"href": "<basepath>/rest/api/latest/plan/DS-ASVCCRED",
"rel": "self"
},
"key": "{projectKey}-{buildKey}",
"name": "ABCD",
"planKey": {
"key": "{projectKey}-{buildKey}"
}
},
"buildResultKey": "{projectKey}-{buildKey}-{buildNumber}",
"lifeCycleState": "Finished",
"id": 198039818,
"key": "{projectKey}-{buildKey}-{buildNumber}",
"planResultKey": {
"key": "{projectKey}-{buildKey}-{buildNumber}",
"entityKey": {
"key": "{projectKey}-{buildKey}"
},
"resultNumber": 45
},
"state": "Failed",
"buildState": "Failed",
"number": 45,
"buildNumber": 45
},
If JSON output is desired, just add Accept=application/json header while making a call.
This will return latest 25 build results in a sequence with the latest result being the first. You may go through this results and decide which two build results you are interested in.
Once you decide, you make additional calls to get change set (commit details) captured by bamboo for that particular build.
[GET] <basepath>/rest/api/latest/result/{projectKey}-{buildKey}/{buildNumber : ([0-9]+)|(latest)}?expand=changes
This will give you detailed commit description as below:
"changes": {
"size": 3,
"expand": "change",
"change": [
{
"author": "1234",
"changesetId": "7f76c41a7ff48f679a91d0fa2810ef3398121dc6"
},
{
"author": "abcd",
"changesetId": "104d8b7af9538599a02006005314033c8017e804"
},
{
"author": "cdef",
"changesetId": "d21aef9f3745257aa501425fc31ebd0c6b33f608"
}
],
"start-index": 0,
"max-result": 3
},
And then you can perform
git log <changesetId>...<changesetId>
I have an url,get and response given. I have to parse the JSON and show the locations in Map in android. I dont need you to code. I am new in JSON. please tell me some steps how i can do that. how should i start and which steps i should take?
Url: "Some url"
Sending data:
{
"tag": "getAvailableDriver",
"lat": 41.022348,
"lng": -91.966721
}
RESPONSE:
{
"posts": [
{
"success": "1",
"driver": [
{
"id": "768",
"lat": "41.022848",
"lon": "-91.966884",
"recorded_datetime": "2014-07-20 20:18:03",
"user_id": "403",
"cabbi_state": "OnJob",
"vehicleType": "Black Cab",
"driver_name": "black cab driver",
"pic_name": "userimage/403.jpg",
"rating": "0",
"car_model": "this",
"number_sit": "4",
"distance": 0.035574527536789
}
],
"operator": [],
"nearestdistance": [
{
"distance": 0.03541809,
"time": 5
}
],
"car_models": [
"Taxi"
]
}
]
}
I just want anyone of you to guide me or show me the way. And also please someone tell me what will be the use of "send data" here. What is the use? I promise i will not ask any basic questions after i catch the grip. Help me please.
You can save the parsed data in an array, and for what I can see, there's a lot of tags in the JSON object. I suggest you to create an object of the type "Driver" or "Car", and then save all the data in that object. Once you have the data parsed and saved in an Array of the type of your object (Let's say an array of "Drivers" then you can use the info to add it into the Map.
I was wondering how to get the value of "name" for the following json text with facebook sdk. Assuming I have already got the access token. Any thoughts? Many thanks!
enter code here
{
"id": "100005065353669",
"music": {
"data": [
{
"category": "Musician/band",
"name": "Eason Chan",
"id": "105468519487919",
"created_time": "2013-06-05T20:33:26+0000"
}
],
"paging": {
"next": "https://graph.facebook.com/100005065353669/musiclimit=5000&offset=5000&__after_id=105468519487919"
}
}
}