While working out some questions on comparing the basic nature of various compounds, I came across the following two compounds:
In case of A I could see several resonating structures, and also the −M effect of the nitro group. So justifying based on the number of resonance structures, I could tell that the lone pairs are more delocalized in A than in B. Hence B is more basic.
However, on verifying my answer I found that A was more basic.
The only reason I could come up with is that in compound A, majority of the resonance includes a negative charge on carbon, but in compound B, the negative charge lands on the more electronegative oxygen, which better succeeds in stabilizing it. But it doesn't seem right for me.
Can anyone please tell me the correct reason for this?