json

  1. S

    Accessing a specific item in a JSON return in Rails

    I have this JSON from the NHL API, and I tried to access the value gamesPlayed: "teams"=>[ { "id"=>5, "name"=>"Pittsburgh Penguins", "link"=>"/api/v1/teams/5", "venue"=>{ "id"=>5034, "name"=>"PPG Paints Arena", "link"=>"/api/v1/venues/5034"...
  2. B

    Conflict in routing between Laravel Nova and Dingo API

    I have a Laravel API server which only has one web route (test page), everything else is controlled via dingo/api package and all is working correctly. In config/api.php I've set 'prefix' => env('API_PREFIX', '/') as it's only an API server. I've since installed Laravel Nova and kept getting...
  3. D

    How to access json from Rest API

    I am returning data from a rest API. I was getting the header along with the json, but as Justin T. pointed out below I needed to add this to my cURL: curl_setopt( $ch, CURLOPT_HEADER, 0); That got rid of the header. Now I am having issue with the returned json and the encoding of it(I think)...
  4. B

    How to recursively add unknown primitive elements?

    I want to be able to recursively add elements to a single object, and can't use the salutations[element] syntax as the value of each key will be determined by user input, so I need to primitively use salutations to set each object of greetings. greetings = { key: value, chain: {} } salutations...
  5. R

    How to format Array value from Javascript to Java Servlet using Ajax

    I am in need of your help. I have this array being passed from Javascript to Java Servlet using AJAX. Javascript and AJAX snippet code: var BuildingNo = []; $(xml).find('BUILDING').each(function(){ BuildingNo.push($.trim(this).children('BuildingNo').text()); } The value of BuildingNo...
  6. A

    Mapping JSON response to Java POJO Class using GSON

    I am trying to map below JSON to a POJO Class using Gson library. Below is the JSON response and POJO Class and mapping done import java.util.Map; import com.google.gson.JsonElement; public class DataResponse { private String $status; private Map<String, JsonElement> $payload; public String...
  7. P

    Include a php variable in json schema data - wordpress site - invalid json error

    <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "LocalBusiness", "name": "storename", "image": "https://staticqa.store.com/wp-content/themes/faf/images/store-logo.png", "@id": '.json_encode($storeid)'., "url": "", "telephone"...
  8. W

    Passing JSON with functions via AJAX

    Quite simply, I'd like to "re-hydrate" functions which are passed from AJAX, as follows: //AJAX response: {"foo":"bar","baz":"function(){console.log('I am back working as a function!');}"} And obviously, baz should be a function and not a string. How would I do this?
  9. O

    How to handle malformed json for a route with 'defaults: {format: :json}'?

    I have a url which is supposed to accept only json: put "/my_url" => "my_controller#my_actio", defaults: {format: :json} When I send malformed json to it, it doesn't make to an "action" at all and instead it throws an exception somewhere in Rails and thus my app ends up returning the error...
  10. M

    How to separate json object array received from php?

    I need to separate the 3 php objects arrays after json receiving them. Php code: $row = array(array($directionsStart),array($directionsEnd),$directionsWaypointArray); echo json_encode($row); the output of php: [["Belo Horizonte, Minas Gerais"],["Maric\u00e1, Rio de Janeiro"],["Monte Mor...
  11. M

    Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $ with retrofit

    Retrofit is throwing the above error. I have tried some of the solutions i saw here but none is working. Here is my code public void getMaterials() { RestAdapter adapter = new RestAdapter.Builder().setEndpoint(Root_Url).build(); materialAPI api =...
  12. C

    Android Fatal Error java.lang.IllegalStateException: Could not execute method for android:onClick

    The following error i faced E/AndroidRuntime: FATAL EXCEPTION: main Process: com.standardcoach.ticketing, PID: 12763 java.lang.IllegalStateException...
  13. P

    Truy cập JSON Data từ HTML - Angular 4

    Mình có dữ liệu JSON này mà mình cần truy cập từ HTML của mình bằng MatCellDef của Angular 4. Mình cần đọc FROM, TO, PERCENT và SUBTRACT của mảng RateBands. File JSON: [ { "yearlyincentive":{ "incentive":{ "number":"0", "description":"null"...
Top