Malformed JSON error

Showing 1-8 of 8 messages
Malformed JSON error Kyle Maxwell 4/25/12 9:12 AM
Now that I think I have everything running, I thought I'd issue my first query:

$ sift -q infrastructure/botnet

That didn't quite go as planned:

malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "<response message="i...") at /usr/share/perl5/JSON.pm line 171.

The line in question appears to be a call to $json->decode in sub from_json, so I'm guessing I really do have malformed data in the database. This turns out to happen regardless of the specific query I run (infrastructure/malware, domain/botnet, etc.)
Re: Malformed JSON error wes 4/25/12 9:33 AM
what does your apache config[1] look like? Looks like the web-server is returning XML instead of JSON...

do you have the following line in your location config ?

PerlSetVar Apache2RESTWriterDefault 'json'

based on the config below..

• create your config at /etc/apache2/cif.conf, which should look like:
<Location /api>
    SetHandler perl-script
    PerlSetVar Apache2RESTHandlerRootClass "CIF::WebAPI::Plugin"
    PerlSetVar Apache2RESTAPIBase "/api"
    PerlResponseHandler Apache2::REST
    PerlSetVar Apache2RESTWriterDefault 'json'
    PerlSetVar Apache2RESTAppAuth 'CIF::WebAPI::AppAuth'

    # feed defaults
    PerlSetVar CIFLookupLimitDefault 500
    PerlSetVar CIFDefaultFeedSeverity "high"

    # extra outputs
    PerlAddVar Apache2RESTWriterRegistry 'table'
    PerlAddVar Apache2RESTWriterRegistry 'CIF::WebAPI::Writer::table'
</Location>

[1] http://code.google.com/p/collective-intelligence-framework/wiki/ServerInstall#Apache2
--
Wes
claimid.com/wesyoung

Re: Malformed JSON error Kyle Maxwell 4/25/12 10:35 AM
Yup, I had a typo in /etc/apache2/cif.conf. Thanks!
Re: Malformed JSON error Benny K 8/2/12 7:07 PM
I have the exact same error and already checked my apache conf.....

I re-installed everything from scratch on a beefy machine running ubuntu 12.04. Installation went fine this time and everything was followed step by step. What did I overlook?

TIA
Re: [ci-framework] Malformed JSON error wes 8/3/12 3:44 AM
something is foo-bar'd with your apache config, the API is spitting out XML and the client is expecting JSON.

what does your config look like?

On Aug 2, 2012, at 10:07 PM, Benny K wrote:

> I re-installed everything from scratch on a beefy machine running ubuntu 12.04. Installation went fine this time and everything was followed step by step. What did I overlook?

--
Wes
wesyoung.me

Re: [ci-framework] Malformed JSON error kl 9/23/12 9:19 AM
Hi there
I'm getting the same error when running cif feeds, attached.

My apache file seems fine:

cif@domU-12-31-39-08-06-20:/etc/apache2$ vi cif.conf
<Location /api>
    SetHandler perl-script
    PerlSetVar Apache2RESTHandlerRootClass "CIF::WebAPI::Plugin"
    PerlSetVar Apache2RESTAPIBase "/api"
    PerlResponseHandler Apache2::REST
    PerlSetVar Apache2RESTWriterDefault 'json'
    PerlSetVar Apache2RESTAppAuth 'CIF::WebAPI::AppAuth'

    # feed defaults
    PerlSetVar CIFLookupLimitDefault 10000
    PerlSetVar CIFDefaultFeedSeverity "high"

    # extra outputs
    PerlAddVar Apache2RESTWriterRegistry 'table'
    PerlAddVar Apache2RESTWriterRegistry 'CIF::WebAPI::Writer::table'
</Location>

Re: [ci-framework] Malformed JSON error kl 9/23/12 9:44 AM
Hi
And my .cif file looks like:

[cif_feeds]
maxrecords = 10000
severity_feeds = high,medium
confidence_feeds = 95,85,65,50
apikeys = role_everyone_feed
max_days = 5
disabled_feeds = hash,rir,asn,countrycode,malware

[client]
apikey = 11f35124-fdef-40b7-982f-f2f1cbf07611
timeout = 60
verify_tls = 0
Re: [ci-framework] Malformed JSON error wes 9/24/12 5:16 AM
we're taking this offline... :)

On Sep 23, 2012, at 12:19 PM, 12 wrote:

> Hi there

--
Wes
wesyoung.me