☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

TypeError: True is not JSON serializable

Community Support
Amy_Ding
Amy_Ding

I’m creating a pandas dataframe in a bokeh-server dependent applet, and I’m getting an error that ‘TypeError: True is not JSON serializable’ referencing back to to L89 in protocol.py. This only happens when my df contains a column of bool values. I can convert the column to string, and back, but that seems rather inefficient. Is there a way I can get around this issue?

For more detail: I’m running bokeh 0.7.1 on python 2.7 via Anaconda, on Windows 7

⌁   Link to post
Bryan
Bryan

This might be a bug, can you file a GitHub issue? We are about to have a code freeze for 0.8 release but this kind of fix could go in a dev build soon after that.

Thanks,

Bryan

···

On Feb 11, 2015, at 8:39 AM, ading@whitebaytech.com wrote:

I'm creating a pandas dataframe in a bokeh-server dependent applet, and I'm getting an error that 'TypeError: True is not JSON serializable' referencing back to to L89 in protocol.py. This only happens when my df contains a column of bool values. I can convert the column to string, and back, but that seems rather inefficient. Is there a way I can get around this issue?

For more detail: I'm running bokeh 0.7.1 on python 2.7 via Anaconda, on Windows 7

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5661135f-c465-473d-9409-431fb8e7bd15%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Mateusz_Paprocki
Mateusz_Paprocki

Hi,

···

On Wed, Feb 11, 2015 at 3:39 PM, ading@whitebaytech.com wrote:

I’m creating a pandas dataframe in a bokeh-server dependent applet, and I’m getting an error that ‘TypeError: True is not JSON serializable’ referencing back to to L89 in protocol.py. This only happens when my df contains a column of bool values. I can convert the column to string, and back, but that seems rather inefficient. Is there a way I can get around this issue?

For more detail: I’m running bokeh 0.7.1 on python 2.7 via Anaconda, on Windows 7

I can reproduce this:

In [1]: import pandas as pd

In [2]: from bokeh.protocol import *

In [3]: pd.DataFrame({“x”: True, “y”: False}, index=[0, 1]).to_dict()
Out[3]: {‘x’: {0: True, 1: True}, ‘y’: {0: False, 1: False}}

In [4]: serialize_json(_)
(…)
TypeError: False is not JSON serializable

In [5]: type(3[‘x’][0])
Out[5]: numpy.bool

Bryan, I will take care of this.

Mateusz

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5661135f-c465-473d-9409-431fb8e7bd15%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Mateusz_Paprocki
Mateusz_Paprocki

Hi,

···

On Wed, Feb 11, 2015 at 4:55 PM, Mateusz Paprocki mateusz.paprocki@continuum.io wrote:

Hi,

Fixed in PR #1854.

Mateusz

On Wed, Feb 11, 2015 at 3:39 PM, ading@whitebaytech.com wrote:

I’m creating a pandas dataframe in a bokeh-server dependent applet, and I’m getting an error that ‘TypeError: True is not JSON serializable’ referencing back to to L89 in protocol.py. This only happens when my df contains a column of bool values. I can convert the column to string, and back, but that seems rather inefficient. Is there a way I can get around this issue?

For more detail: I’m running bokeh 0.7.1 on python 2.7 via Anaconda, on Windows 7

I can reproduce this:

In [1]: import pandas as pd

In [2]: from bokeh.protocol import *

In [3]: pd.DataFrame({“x”: True, “y”: False}, index=[0, 1]).to_dict()
Out[3]: {‘x’: {0: True, 1: True}, ‘y’: {0: False, 1: False}}

In [4]: serialize_json(_)
(…)
TypeError: False is not JSON serializable

In [5]: type(3[‘x’][0])
Out[5]: numpy.bool

Bryan, I will take care of this.

Mateusz

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5661135f-c465-473d-9409-431fb8e7bd15%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled