1

I have a binary file which contains a lot of strings, is there any way to find JSON format strings in this file?

If I have encoded this file to one big String in my program, can i use some search engine in Java to find all strings of the form of JSON format?

Is it possible to use Java's pattern matching? if so what regex will be used to describe a recursive data structure like JSON?

Shaun
  • 2,446
  • 19
  • 33
user1010822
  • 111
  • 2
  • 7
  • JSON is not a regular language (because of the nesting of braces and curly brackets), so do not waste your time there. – Po' Lazarus Nov 22 '11 at 12:42
  • Regexes have progressed far beyond regular languages, so this argument doesn't really hold, at least if you use a reasonably modern regex flavor like Perl, PCRE or .NET, all of which handle recursion just fine, thank you. AFAIK, Java's regex engine does not support recursion, though. – Tim Pietzcker Nov 22 '11 at 12:50

1 Answers1

0

Yikes!

I would think a more efficient and accurate solution would be to include a String constant in all of your JSON serializable objects and search for that.

Thom
  • 14,013
  • 25
  • 105
  • 185