Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help generating JSON data - I am using FlexJSON lib

 
André Asantos
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know why that generates the following JSON return below:


That shoud generate the following below:


regards,
André AS
 
André Asantos
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Code:
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know the FlexJSON library, but I'd expect that the way the JSON looks will be determined from the structure of the object that you are converting to JSON.

What is the object pessoaImagemGaleria - what does its class look like?
 
André Asantos
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jasper, thanks for helping me...

That object has lists (four) and some attributes (also four).
 
André Asantos
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jasper,
let me tell a new, I've got to return a right JSON format data now , but not 100% right, let me explain:

That shows:


However that should show this bellow:


I imagine that happens because that object has lists, but why?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show the source code of the class of pessoaImagemGaleria? Or just an outline of what member variables it has?

Looking at the JSON, I would guess that it looks like this:


If you want the second kind of output, it should be something like this:
 
André Asantos
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Jasper, thanks a lot for helping me out.

That's working now your clue helped me a lot.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic