0

I have a JavaScript array like this:

var f3_masks = [
    [
        {id: 0, id_name: '1-1', db_id: '3193586'},
        {id: 10, id_name: '3-4', db_id: '3193636'},
        {id: 20, id_name: '3-5', db_id: '3193636'}
    ],
    page2_fl = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],

    page2_fr = [
        './images/korpus1/floors/floor_3.jpg'
    ]
];

var f4_masks = [
    [
        {id: 0, id_name: '1-1', db_id: '3193586'},
        {id: 10, id_name: '3-4', db_id: '3193636'},
        {id: 20, id_name: '3-5', db_id: '3193636'}
    ]
];

etc. It's a pretty large set of arrays with thousands of strings. Part of it I can parse as JSON, but only part of it. What is the best way to read such JavaScript arrays without a regular stucture in PHP?

4
  • Didn't vote down, but that looks like a syntax error. Commented Apr 12, 2013 at 22:41
  • JSON will work for you Commented Apr 12, 2013 at 22:42
  • How wouild it work? It is not valid JSON array. Commented Apr 12, 2013 at 22:50
  • Mario, thank you. Very similar questions, but not exactly my case. I have a set of vars, not just one. Commented Apr 12, 2013 at 22:59

1 Answer 1

-1

Keys must be in double quotes:

"page2_fl"

Try to use the checking service at http://jsonlint.com/.

Sign up to request clarification or add additional context in comments.

1 Comment

I cannot change format of this array. I need to parse it in PHP as is.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.