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

  • SEARCH
  • Home
  • 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 7504583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:37:28+00:00 2026-05-29T21:37:28+00:00

My server returns a list of objects in JSON. They might be Cat s

  • 0

My server returns a list of objects in JSON. They might be Cats or Dogs, for example.

When I know that they’ll all be Cats, I can set the AutoBeanCodex to work easily. When I don’t know what types they are, though… what should I do?

I could give all of my entities a type field, but then I’d have to parse each entity before passing it to the AutoBeanCodex, which borders on defeating the point. What other options do I have?

  • 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-05-29T21:37:31+00:00Added an answer on May 29, 2026 at 9:37 pm

    Just got to play with this the other day, and fought it for a few hours, trying @Category methods and others, until I found this: You can create a property of type Splittable, which represents the underlying transport type that has some encoding for booleans/Strings/Lists/Maps. In my case, I know some enveloping type that goes over the wire at design time, and based on some other property, some other field can be any number of other autobeans.

    You don’t even need to know the type of the other bean at compile time, you could get values out using Splittable‘s methods, but if using autobeans anyway, it is nice to define the data that is wrapped.

    interface Envelope {
      String getStatus();
      String getDataType();
      Splittable getData();
    }
    

    (Setters might be desired if you sending data as well as recieving – encoding a bean into a `Splittable to send it in an envelope is even easier than decoding it)

    The JSON sent over the wire is decoded (probably using AutoBeanCodex) into the Envelope type, and after you’ve decided what type must be coming out of the getData() method, call something like this to get the nested object out

    SpecificNestedBean bean = AutoBeanCodex.decode(factory, 
                                                   SpecificNestedBean.class, 
                                                   env.getData()).as();
    

    The Envelope type and the nested types (in factory above) don’t even need to be the same AutoBeanFactory type. This could allow you to abstract out the reading/writing of envelopes from the generic transport instance, and use a specific factory for each dataType string property to decode the data’s model (and nested models).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I return a list of Question objects in XML or JSON? @Path(all)
I understand that SQL Server endpoint returns data using SOAP. Does anyone know if
I have a function on my server code that returns a list of ElementRow
I have a stored procedure in a SQL Server database that returns a list
I have an HTTP server that returns large bodies in response to POST requests
I've created a miniature 'web server' that simply returns one message to any request
Let's say I have a stored procedure in Microsoft SQL Server 2005 that returns
My class objects are not getting converted into json, I think it returns object
I'm having a strange problem with my WCF service that returns data in JSON
I am posting to the server using jquery ajax using $.post. After server returns

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.