I'm writing a compiler to generate a JSON code from a random simple text but I didn't understand the type of these kind of compiler. can I consider it as a source-to-source compiler?
A source-to-source compiler is a compiler that takes the source code of a program written in one programming language as its input and produces the equivalent source code in another programming language.
(the problem is the input is a text, not a the source code of a program written in one programming language)
Or is there another type for these kind of compilers? and thank you
Generally, a source-to-source compiler is understood to
translate between programming languages that operate at approximately the same level of abstraction
Thus, I would argue -- that if by "random simple text" you mean a simple English phase -- you are just writing a regular old compiler.
I.E., I would consider English a "high-level language," and JSON a relatively "low-level language." Thus meaning that you are compiling from a higher level of abstraction to a lower level of abstraction -- just like a regular compiler.