i wrote a test because ur code cannot be run on my machine

require 'json'
items = JSON.parse('{"test":12334, "test1": [{"a":1,"b":2},2,3]}')
items["test1"][0].each{|item|
 p item
}
it looks good
a hash can be "each"
so try to "p" the variable before "each" it?

2010/8/12 Samuel Sternhagen <samatoms / gmail.com>

> jason joo wrote:
> > in ur example data there are only 3 items in the "result" and the
> > element of
> > "count" has a value of 52
> > in ur for-loop u will access 3-51 ones which do not exist
> > u may use table["results"].size instead of table["count"]
> >
> > 2010/8/12 Samuel Sternhagen <samatoms / gmail.com>
>
> In my while loop I am using "table["count"]. If you run this code it
> produces output that starts with:
>
>
> "{\"count\":52,\"results\":[{\"name\":\"getMethodTable\",\"description\":\"Get
> a list of all methods
>
> available.\",\"uri\":\"\\/\",\"params\":null,\"defaults\":null,\"type\":\"method\",\"visibility\":\"public\",\"http_method\":\"GET\"}
>
> My while loop is using table["count"] as the limit. Sorry for the
> confusion.
> --
>  Posted via http://www.ruby-forum.com/.
>
>