Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9135977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:53:34+00:00 2026-06-17T08:53:34+00:00

My json string is: { sigTemplateId: 1, name: Test Ticket Template, groups: [{\sigTemplateId\: 1,

  • 0

My json string is:

{
    "sigTemplateId": 1,
    "name": "Test Ticket Template",
    "groups": "[{\"sigTemplateId\": 1, \"sigTemplateGroupId\": 1, \"name\": \"Group 1\", \"ordinal\": 1}]"
}

This gets sent from my jsp to the servlet. Servlet code is:

Gson gson = new Gson();

if (jsonData != null) {
    Type objType = new TypeToken<SigTemplateObj>() {}.getType();
    SigTemplateObj sigTemplateToSave = gson.fromJson(jsonData, objType);
    //SigTemplateObj sigTemplateToSave = gson.fromJson(jsonData, SigTemplateObj.class);
}

I get by: java.lang.IllegalStateException: This is not a JSON Array. gson trying to parse the groups array: The JsonDeserializer com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter@1f4db697 failed to deserialize json object “[{\”sigTemplateId\”: 1, \”sigTemplateGroupId\”: 1, \”name\”: \”Group 1\”, \”ordinal\”: 1}]” given the type java.util.ArrayList

My object code is:

public class SigTemplateObj {

    int sigTemplateId;
    String dyninkName;
    int dyninkFormId;
    String name;

    //children collections
    ArrayList<SigTemplateFieldObj> fields;
    ArrayList<SigTemplateGroupObj> groups;
...
}

public class SigTemplateGroupObj {
    int sigTemplateGroupId;
    int sigTemplateId;
    int ordinal;
    String name;
...
}

I have tried both the code above and this line as well and got the same results both times.

SigTemplateObj sigTemplateToSave = gson.fromJson(jsonData, SigTemplateObj.class);

Any help would be appreciated.
Thanks,
Eric

Now I just have to fix my javascript to treat the groups array as an array and not a string:

var testObject = new Object();
        testObject.sigTemplateId = 1;
        testObject.name = 'Test Ticket Template';
        testObject['groups'] = [];
        var testGroup = new Object();
        testGroup.sigTemplateId = 1;
        testGroup.sigTemplateGroupId = 1;
        testGroup.name = 'Group 1';
        testGroup.ordinal = 1;
        testObject.groups.push(testGroup);

        var json = JSON.stringify(testObject);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:53:34+00:00Added an answer on June 17, 2026 at 8:53 am

    The groups array is not an array, but a string:

    "groups": "..."
    

    Try this JSON instead:

    {
        "sigTemplateId": 1,
        "name": "Test Ticket Template",
        "groups": [{"sigTemplateId": 1, "sigTemplateGroupId": 1, "name": "Group 1", "ordinal": 1}]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following JSON string (from wikipedia http://en.wikipedia.org/wiki/JSON ) { name:Product, properties: {
I'm getting this json string info from the server : {members:[[sd2840d,Johny],[jkld341,Marry]]} So I store
I have a JSON String like this $test='{var1:null,var3:null,status:{code:150,message:blah blah}}'; I want to access the
Json String: (response) {19:{id:19,name:Product,sku:123,price:59.50,cost:25.00},20:{id:20,name:Test,sku:456,price:50.00,cost:40.00}} JavaScript Code: var json = $.parseJSON(response); var items = new
I have this JSon string received from an AJAX call: {status:OK,addresses:[0,1,2,3,4,5]} To convert it
I have an JSON string that gets returned from the server that i'm trying
I am receiving JSON string response from my WCF service. I wanna parse this
I get a JSON String from a Servlet und want to parse this string
Consider this as my json string, {Table : [{userid : 11,name : KumarP,designation :
my Json string is {'message':'Test Driver'} if i try to Nslog this code NSLog(@%@,[parser

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.