logo
down
shadow

java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY In my mcmod.info JSON file?


java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY In my mcmod.info JSON file?

By : user2949918
Date : November 17 2020, 04:28 AM
seems to work fine In a mcmod.info file, the "credits" section is supposed to be a string, not an array as you have it:
code :
"credits": [],
{
  "modid": "BuildCraft|Core",
  "name": "BuildCraft",
  "version": "4.2.2",
  "mcversion": "1.6.4",
  "description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more!",
  "credits": "Created by SpaceToad",
  "logoFile": "/assets/buildcraft/logo.png",
  "url": "http://www.mod-buildcraft.com/",
  "updateUrl": "",
  "authors": [ "SpaceToad", "BuildCraft Team" ],
  "parent":"",
  "screenshots": [],
  "dependencies": [
     "mod_MinecraftForge"
  ]
}


Share : facebook icon twitter icon
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING


By : Nana Zameri
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further This is my first approach to serialization using Gson. I recive facebook response to my android application like this , Change your FacebookResponses class to these:
code :
private class FacebookResponses {
    private Data[] data;
}

private class Data {
    @SerializedName("pic_square")
    private String picSquare;
    private String uid;
    private String name;
}
Json parse using GSON : JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY

Json parse using GSON : JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY


By : user3927097
Date : March 29 2020, 07:55 AM
hop of those help? Remove square bracket from first and last and try .
So your string will be like below .
code :
{"place_id":"14004695","licence":"Data © OpenStreetMap contributors, ODbL 1.0. http:\/\/www.openstreetmap.org\/copyright","osm_type":"node","osm_id":"1292272363","boundingbox":["48.8634698","48.8635698","2.3724866","2.3725866"],"lat":"48.8635198","lon":"2.3725366","display_name":"42, Rue de la Folie-Méricourt, St-Ambroise, 11th Arrondissement, Paris, Ile-de-France, Metropolitan France, 75011, France","class":"place","type":"house","importance":0.611}
Retrofit 2.0 java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING

Retrofit 2.0 java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING


By : Elcio Tiki
Date : March 29 2020, 07:55 AM
I hope this helps you . As Pankaj Kumar supposed - char[] iso is the problem. Changing type to String solved it!
Convert Map<String, String> to List of POJO - java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING

Convert Map<String, String> to List of POJO - java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING


By : zaggler
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Currently, I plan to convert the following Map to List of POJO. , The problem is that the original map's values will stay a String.
code :
    String mJsonString = m.entrySet().stream()
            .map(e -> String.format("\"%s\":%s", e.getKey(), e.getValue()))
            .collect(Collectors.joining(",", "{", "}"));

    System.out.println(mJsonString);

    final Gson gson = new GsonBuilder().create();
    StockPriceAlertResponse stockPriceAlertResponse = gson.fromJson(mJsonString,
            StockPriceAlertResponse.class);
    List<StockPriceAlert> stockPriceAlerts = stockPriceAlertResponse.getStockPriceAlerts();
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING while using Gson library

java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING while using Gson library


By : Tegene Habtamu
Date : March 29 2020, 07:55 AM
will help you Do you verify the json format? I have reformated as below then it works.
code :
     [
      {
        "heading": "Bike Services",
        "content": [
          {
            "title": "General Service",
            "icon": "bike_service_img"
          },
          {
            "title": "Premium Bike Service",
            "icon": "bike_service_img"
          },
          {
            "title": "Repair Job",
            "icon": "bike_service_img"
          },
          {
            "title": "Bike Ceramic Coating",
            "icon": "bike_service_img"
          }
        ]
      },
      {
        "heading": "Bike Service Centre Near You",
        "content": [
          {
            "title": "Bike Shop Name one",
            "icon": "bike_service_centre_img"
          },
          {
            "title": "Bike Shop Name two",
            "icon": "bike_service_centre_img"
          },
          {
            "title": "Bike Shop Name three",
            "icon": "bike_service_centre_img"
          },
          {
            "title": "Bike Shop Name four",
            "icon": "bike_service_centre_img"
          },
          {
            "title": "Bike Shop Name five",
            "icon": "bike_service_centre_img"
          },
          {
            "title": "Bike Shop Name six",
            "icon": "bike_service_centre_img"
          }
        ]
      },
      {
        "heading": "Car Services",
        "content": [
          {
            "title": "Express Service",
            "icon": "car_service_img"
          },
          {
            "title": "Dent/Scratch Removal",
            "icon": "car_service_img"
          },
          {
            "title": "Interior Detailing",
            "icon": "car_service_img"
          },
          {
            "title": "Oil Change Package",
            "icon": "car_service_img"
          },
          {
            "title": "Complete Car Spa",
            "icon": "car_service_img"
          },
          {
            "title": "AC Service",
            "icon": "car_service_img"
          }
        ]
      },
      {
        "heading": "Car Service Centre Near You",
        "content": [
          {
            "title": "Car Shop Name one",
            "icon": "car_service_centre_img"
          },
          {
            "title": "Car Shop Name two",
            "icon": "car_service_centre_img"
          },
          {
            "title": "Car Shop Name three",
            "icon": "car_service_centre_img"
          },
          {
            "title": "Car Shop Name four",
            "icon": "car_service_centre_img"
          },
          {
            "title": "Car Shop Name five",
            "icon": "car_service_centre_img"
          },
          {
            "title": "Car Shop Name six",
            "icon": "car_service_centre_img"
          }
        ]
      }
    ]
Related Posts Related Posts :
  • Content autocomplete in spring tool suite 4
  • Super Noob Help ~ MouseEvent/Frame
  • Making one project with dependencies stand-alone in Eclipse (Java)
  • Jsoup- getting certain attributes from website
  • MongoDB, how to make a link between collections with JAVA code
  • Overriding an abstract method means class abstract class or not in java?
  • Bukkit teleport - nullPointerException
  • How to check if a Float variable is negative in java
  • Servlet: Cannot forward after response has been committed
  • sql query to select a specific cell in excel
  • How to make new picture when mouse dragged in java
  • Use Constants interface in GWT Project
  • Setting size of a JPanel in GroupLayout
  • Construct a map from two equal size arrays
  • Implementing Read-Write Locks with Double-Checked Locking
  • Disable NO_BUTTON from JOptionPane Java if a condition is true
  • UDP multiple socket
  • Android Threading: This Handler class should be static or leaks might occur
  • The type org.openqa.selenium.firefox.FirefoxDriver is not accessible
  • Limitations (drawbacks) of java programming language?
  • Error: ')' expected Error: illegal start of expression
  • TableRowSorter use LookAndFeel of TableHeader, but own Comparator
  • Difference between @GeneratedValue and @GenericGenerator
  • Design Scenario: Smartphone class and will have derived classes like IPhone,AndroidPhone,WindowsMobilePhone can be even
  • Java date parsing without separators?
  • how to map an array of custom type from postgres to java using hibernate
  • Why hibernate always call "update" statement after using "select" statement in MySQL?
  • An interview topic: What can go wrong with this code?
  • How do I regex remove whitespace and newlines from a text, except for when they are in a json's string?
  • How to turn off Preferences > Compiles > User External Build?
  • how to convert arraylist to string array with all items in double quote
  • PMD+Maven+JAVA Error:: Can't find resource rulesets/comments.xml. Make sure the resource is a valid file or URL or is on
  • How to extend AbstractScheduledService.Scheduler
  • Primefaces tabview: set Active Index after some counting
  • Need help in Regex to exclude splitting string within "
  • Get header from HttpUrlConnection object
  • encoding xlsx as base64 and send it as an attachment
  • How to acess HttpServletRequest in Jaas login module in Tomcat
  • How to implement a basic pointer
  • Java Swing Exit Icon?
  • Why onNext has no effect
  • IntelliJ Idea 2018.2 no option for importing gradle project
  • Remove a negative element from an array w/o array.copy
  • Could this prevent overflow in Java?
  • In Java Swing, can I receive Caret events in real time?
  • I need help not using brute force when using JFrames and DrawWindows
  • How do I refactor ArrayList<MyClass> into MyClassLIst?
  • My program keeps saying that the method cannot be resolved
  • BubbleSort -my code returns random addresses
  • JavaFX components inside HTML?
  • Character in Java game not responding
  • Working around access denied in a FileWalking Tree in Java7
  • How to avoid if/else when using multple suppliers?
  • How to pass object from table cell editor to Table Model?
  • Paypal Sandbox payment state pending
  • sejda-console.bat passing parameters with spaces
  • Multiple Consumers Spring Kafka
  • Bitbucket pipeline: environmental variables in build.gradle file not recognized
  • Java static enum method to return a default enum value
  • What is the complexity of empty for loop?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org